How would I use fsolve for 3 unknowns and 3 equations?
조회 수: 23 (최근 30일)
이전 댓글 표시
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
채택된 답변
Star Strider
2022년 5월 27일
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!