How would I use fsolve for 3 unknowns and 3 equations?
20 views (last 30 days)
Show older comments
David Magana
on 27 May 2022
Commented: Star Strider
on 29 May 2022
I'm confused on how to use fsolve when solving for "TT, a_1, b_1" in my code. I'm trying to solve for each of these variables using the 3 equations that are supposed to be in a 3x1 matrix which is set equal to 'equations.' Any help is much appreciated.
clear;clc;format long;
lm1=0; %m
lm2=-0.2; %m
Am=95; %m^2
At=3; %m^2
omega_m=40.2; %1/s
omega_t=228; %1/s
p=1.225; %kg/m^3
w=32000; %N
hm=0.96; %m
lt=6.5; %m
ht=0.72; %m
equations=@(TT a_1 b_1) [lm1*w+hm*w*a_1-1/Qt*sqrt(TT^3/2*p*At)-1/Qm*sqrt(w^3/2*p*Am)*b_1);hm*w*b_1+(ht*TT)+(1/Qm)*sqrt(w^3/2*p*Am)*a_1;1/Qm*sqrt(w^3/2*p*Am)-lt*TT+lm1*w*b_1];
equationsans=fsolve(equations,[1,1,1]');
0 Comments
Accepted Answer
Star Strider
on 27 May 2022
Provide values for ‘Qt’ and ‘Qm’ and then solve it —
clear;clc;format long;
lm1=0; %m
lm2=-0.2; %m
Am=95; %m^2
At=3; %m^2
omega_m=40.2; %1/s
omega_t=228; %1/s
p=1.225; %kg/m^3
w=32000; %N
hm=0.96; %m
lt=6.5; %m
ht=0.72; %m
Qm = rand
Qt = rand
equations=@(TT, a_1, b_1) [(lm1*w+hm*w*a_1-1/Qt*sqrt(TT^3/2*p*At)-1/Qm*sqrt(w^3/2*p*Am)*b_1);hm*w*b_1+(ht*TT)+(1/Qm)*sqrt(w^3/2*p*Am)*a_1;1/Qm*sqrt(w^3/2*p*Am)-lt*TT+lm1*w*b_1];
equationsans=fsolve(@(b)equations(b(1),b(2),b(3)),[1,1,1]')
There was an unpaired parenthesis in the first row of the vector that I completed. That was throwing the error.
.
2 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!