I have this problem Exiting fzero: aborting search for an interval containing a sign change because no sign change is detected during search. Function may not have a root.

6 次查看(过去 30 天)
V3=fzero(@Pr3,0.7);
V3
function y=Pr3(V)
Pr=4;
R=0.08206;
T=450;
Tc=405.5;
Pc=111.3;
P=Pr*Pc;
a=0.42747*((R^2)*Tc^(5/2)/Pc);
b=0.08664*(R*Tc/Pc);
y=((R*T)/(V-b))-(a/(V*(V+b)*T^(1/2)))-P;
end

回答(1 个)

Walter Roberson
Walter Roberson 2024-2-26
syms V
Q = @(v) sym(v);
Pr = Q(4);
R = Q(08206) / Q(10)^5;
T = Q(450);
Tc = Q(405.5);
Pc = Q(1113) / Q(10)^1;
P = Pr*Pc;
a = Q(42747) / Q(10)^5 * ((R^2)*Tc^(5/2)/Pc);
b = Q(08664) / Q(10)^5 * (R*Tc/Pc);
y = ((R*T)/(V-b))-(a/(V*(V+b)*T^(1/2)))-P;
y
y = 
sol = solve(y, 'maxdegree', 3)
sol = 
vpa(sol)
ans = 
  1 个评论
Walter Roberson
Walter Roberson 2024-2-26
format long g
V3=fzero(@Pr3,0.05);
V3
V3 =
0.050876353674731
function y=Pr3(V)
Pr=4;
R=0.08206;
T=450;
Tc=405.5;
Pc=111.3;
P=Pr*Pc;
a=0.42747*((R^2)*Tc^(5/2)/Pc);
b=0.08664*(R*Tc/Pc);
y=((R*T)/(V-b))-(a/(V*(V+b)*T^(1/2)))-P;
end

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Function Creation 的更多信息

标签

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by