Clear Filters
Clear Filters

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 views (last 30 days)
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

Answers (1)

Walter Roberson
Walter Roberson on 26 Feb 2024
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 Comment
Walter Roberson
Walter Roberson on 26 Feb 2024
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

Sign in to comment.

Categories

Find more on Function Creation in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!