Solve multiple equations for multipe variables
1 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 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!