Solve multiple equations for multipe variables

3 views (last 30 days)
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?

Accepted Answer

Cesar Antonio Lopez Segura
Edited: Cesar Antonio Lopez Segura on 21 Sep 2018
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 Comment
Roy Cornelissen
Roy Cornelissen on 21 Sep 2018
Gives the desired result, thank you very much!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by