Solve an equation like the HP calculator solve

5 views (last 30 days)
I would like to know if there is any way to solve an equation like HP's solve, I wanted to find out the value of To2 without having to isolate him.
I think it is possible with fsolve, but I would have to enter the values manually that I had previously calculated and I don't want that. The equation is the last in the code.
S = 547.34
d = 30.42e-3
p = 1.8304
E = 7150
alfa = 19.6e-6
Trup = 14990
ALT = 400
ab = 350
Vp = (160)/3.6
g = 10
% 1º Passo) Hipótese de Carrga
% I - Temperatura mínima
t1 = -5
p1 = p
To1 = 0.33*Trup
% II - Vento máximo
t2 = 15
prol = (1.293 ./ (1 + 0.00367*t2))*((16000 + 64*t2 - ALT) ./(16000 + 64*t2 + ALT));
fprintf('prol = %0.5f kgf/m^3 \n', prol)
q0 = (1/2)*(prol)*(Vp^2);
fprintf('q0 = %0.5f N/m^2 \n', q0)
Fv = q0/10*d;
fprintf('Fv = %0.5f kgf/m^2 \n', Fv)
pv = sqrt(p^2+Fv^2);
p2 = pv;
fprintf('p2 = %0.5f kgf/m \n', p2)
To2 = 0.5*Trup;
fprintf('To2 = %0.5f gf \n', To2)
%III - Maior Duração
t3 = 20;
p3 = p;
To3 = 0.2*Trup;
fprintf('To3 = %0.5f gf \n', To3)
num12 = 24*(alfa*(t2-t1)+(To2-To1)/(E*S))
den12 = (p2/To2)^2 - (p1/To1)^2
clear To2
A = 325
p2 = 1.8304
t2 = 40
t2 - 20 = (1/alfa)*(((To2/p2)*sinh((A*p2)/(2*To2)))/((To1/p1)*sinh((A*p1)/(2*To1)))-1-(1/(E*S))*(To2-To1)) % This equation
% I want to know the value of To2 from the equation above

Accepted Answer

Alan Stevens
Alan Stevens on 6 May 2021
Use fzero. Replace the last line of your code with the following
To2fn = @(To2) (1/alfa).*(((To2/p2).*sinh((A*p2)./(2.*To2)))./((To1/p1).*sinh((A*p1)/(2.*To1)))-1-(1/(E.*S)).*(To2-To1)) - (t2 - 20);
To20 = 1000; % Initial guess
To2 = fzero(To2fn, To20);
disp(To2)

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!