Solve multiple equations for multipe variables

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일

0 개 추천

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by