フィルターのクリア

Solve multiple equations for multipe variables

1 回表示 (過去 30 日間)
Roy Cornelissen
Roy Cornelissen 2018 年 9 月 21 日
コメント済み: Roy Cornelissen 2018 年 9 月 21 日
I have the following problem: I want to solve the equation for b: (12*pi^2*a^4+8*pi^2*a^2*b^2+12*pi^2*b^4)/(3*a^2*b^4) == y
Where a is a constant y N are fixed values, So i give N values of y and i want matlab to return N values for b that solves this equation.'
I have currently done this:
Elastic_prop = E*linspace((f_p/E)*0.5, f_p/E, 5)
n_xx = (12*pi^2*a^4+8*pi^2*a^2*b^2+12*pi^2*b^4)/(3*a^2*b^4);
n_xxv = subs(n_xx, b, sym('b', [1 5]))
n_xxp = solve(n_xxv == Elastic_prop, sym('b', [1 5]))
Can any of you help me with this problem?

採用された回答

Cesar Antonio Lopez Segura
Cesar Antonio Lopez Segura 2018 年 9 月 21 日
編集済み: Cesar Antonio Lopez Segura 2018 年 9 月 21 日
Hi Roy,
Tets this code and let me know if you need some help:
a = 4 ;y = 22.5; % Known values
xo = 1; % initial b val
fun = @(b) ( 12*pi^2*a^4 + 8*pi^2*a^2*b^2 + 12*pi^2*b^4 )/( 3*a^2*b^4 ) - y; % fun definition
fzero( fun,xo )
Here the solution:
b = 2.512065597813919
In a general case with 9 y values the code should be:
%%In case of 9 y values
a = 4 ;
y = [ 22.5 8 7 5 4 3 78 21 96 ];% Known values
for i = 1:length(y)
xo = 1;
fun = @(b) ( 12*pi^2*a^4 + 8*pi^2*a^2*b^2 + 12*pi^2*b^4 )/( 3*a^2*b^4 ) - y(i);
b(i)= fzero( fun,xo );
end
b
Command window response:
b =
2.512065597813919 3.650354401760769 3.880731223730568 4.671356482408150 5.534336598056011 8.191022687818798 1.752511072336621 2.567332724890523 1.656264772243542
  1 件のコメント
Roy Cornelissen
Roy Cornelissen 2018 年 9 月 21 日
Gives the desired result, thank you very much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by