where I am making a mistake while using fsolve to evaluate two unknown with two equation
1 回表示 (過去 30 日間)
古いコメントを表示
N2 = 6;
N1 = 5;
R2 = (80.02*N1/(N1+N2));
ha = (80.02*N1/(N1+N2))-35.2088;
hd = (80.02*N2/(N1+N2))-23.4725;
u = degtorad(6.291);
R1 = (80.02*N2/(N1+N2));
rho1 = 1.675;
f1 = @(N1, N2, R1, R2, ha, hd, u, rho1, theta2, t)[((R2*theta2-((ha-rho1)./tan(u)-t./sin(u)))./cos(-atan(((R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*cos(theta2)-R2)./((R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*sin(theta2))))-R1*(1-cos((N2./N1)*(theta2-((ha-rho1)./tan(u)-t./sin(u))./R2)))./sin((-atan(((R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*cos(theta2)-R2)./((R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*sin(theta2))))+((N2./N1)*(theta2-((ha-rho1)./tan(u)-t./sin(u))./R2)))-hd),
(-R2*theta2+(R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*sin(theta2)-((-((ha-rho1)./tan(u)-t./sin(u))+(R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*sin((((ha-rho1)./tan(u)-t./sin(u))./R2)))./cos(u)+rho1+t*tan(u))*cos(-atan(((R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*cos(theta2)-R2)./((R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*sin(theta2))))+((ha-rho1)./tan(u)-t./sin(u)))];
x=fsolve(@(theta2,t)f1(N1, N2, R1, R2, ha, hd, u, rho1, theta2, t),[degtorad(20),1]);
0 件のコメント
採用された回答
Star Strider
2023 年 7 月 6 日
Only one minor problem. The fsolve function needs and returns a vector of paramters.
Changing that call to:
x=fsolve(@(b)f1(N1, N2, R1, R2, ha, hd, u, rho1, b(1), b(2)),[degtorad(20),1])
so that ‘theta2’ is ‘b(1)’ and ‘t’ is ‘b(2)’ gives it what it wants, and it now works —
N2 = 6;
N1 = 5;
R2 = (80.02*N1/(N1+N2));
ha = (80.02*N1/(N1+N2))-35.2088;
hd = (80.02*N2/(N1+N2))-23.4725;
u = degtorad(6.291);
R1 = (80.02*N2/(N1+N2));
rho1 = 1.675;
f1 = @(N1, N2, R1, R2, ha, hd, u, rho1, theta2, t)[((R2*theta2-((ha-rho1)./tan(u)-t./sin(u)))./cos(-atan(((R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*cos(theta2)-R2)./((R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*sin(theta2))))-R1*(1-cos((N2./N1)*(theta2-((ha-rho1)./tan(u)-t./sin(u))./R2)))./sin((-atan(((R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*cos(theta2)-R2)./((R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*sin(theta2))))+((N2./N1)*(theta2-((ha-rho1)./tan(u)-t./sin(u))./R2)))-hd),
(-R2*theta2+(R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*sin(theta2)-((-((ha-rho1)./tan(u)-t./sin(u))+(R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*sin((((ha-rho1)./tan(u)-t./sin(u))./R2)))./cos(u)+rho1+t*tan(u))*cos(-atan(((R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*cos(theta2)-R2)./((R2./(cos(((ha-rho1)./tan(u)-t./sin(u))./R2)+sin(((ha-rho1)./tan(u)-t./sin(u))./R2)*tan(u)))*sin(theta2))))+((ha-rho1)./tan(u)-t./sin(u)))];
x=fsolve(@(b)f1(N1, N2, R1, R2, ha, hd, u, rho1, b(1), b(2)),[degtorad(20),1])
.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!