Please, I would kindly need assistance to solve for p...with the current code, the derivative of psifun (a nonlinear integral equation) is zero, which ought not. Thanks
Solving for Root of a Non-linear Integral Equation
4 views (last 30 days)
Show older comments
TR = 170+520;
Pc = 692;
Tc = 374;
g = 0.71;
qsc = 4;
kh = 29.8;
phih = 1.9;
rw = 0.5;
Pinit = 3546
pb = 14.65;
%Calculations
syms p
ci = 1/Pinit;
n=0.038-0.026*sqrt(TR/Tc);
m=0.51*(TR/Tc)^-4.133;
zi=1-m*(Pinit/Pc)+n*(Pinit/Pc)^2+0.0003*(Pinit/Pc)^3;
Ki=(9.4+0.02*29*g)*TR^1.5/(209+19*29*g+TR);
Xi=3.5+986/TR+0.29*g;
Yi=2.4-0.2*Xi;
ugi=1e-4*Ki*exp(Xi*(29*g*Pinit/(zi*10.732*TR*62.4))^Yi);
psif=@(p) p./((1-m*(p/Pc)+n*(p/Pc).^2+0.0003*(p/Pc).^3).*(1e-4*Ki*exp(Xi*(29*g*p./((1-m*(p/Pc)+n*(p/Pc).^2+0.0003*(p/Pc).^3)*10.732*TR*62.4)).^Yi)));
psifun=2*int(psif,pb,p)-20000;
p0=2000;
dp=diff(psifun,p);
ddp=diff(dp,p);
dp0=double(subs(dp,p,p0));
ddp0=double(subs(ddp,p,p0));
psifun0=double(subs(psifun,p,p0));
while(((psifun0*ddp0)/(psifun0^2))>1)
p0=2000;
psifun0=double(subs(psifun,p,p0));
dp0=double(subs(dyp,p,p0));
ddp0=double(subs(ddp,p,p0));
end
p1=p0-(psifun0/dp0);
while (abs(p1-p0)>0.0001)
p0=p1;
psifun0=double(subs(psifun,p,p0));
dp0=double(subs(dp,p,p0));
p1=p0-(psifun0/dp0);
end
3 Comments
Walter Roberson
on 4 Dec 2015
my calculation is that psoln is between 15.5618609866312 and 15.5618609866313
Answers (1)
Walter Roberson
on 24 Nov 2015
int() is for symbolic integration, and should be applied to a symbolic expression. You are applying it to anonymous function instead.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!