where I am making a mistake while using fsolve to evaluate two unknown with two equation
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
Star Strider
on 6 Jul 2023
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 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!