필터 지우기
필터 지우기

Solve an equation like the HP calculator solve

조회 수: 2 (최근 30일)
Luccas S.
Luccas S. 2021년 5월 6일
답변: Alan Stevens 2021년 5월 6일
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

채택된 답변

Alan Stevens
Alan Stevens 2021년 5월 6일
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)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by