clc, cleara1=28*7*400; %%ft^2
po=40.6; %%psi
delpio=9; %%psiqf=1525; %%gpm
qo=qf;pp=16.4; %%psiqp=1234; %%gpmdepr1=24.9; %%psidelpr2=18.2; %%psiPH=360; %%ft
lp=2.76*.264/(60)^2*14.5; %%gal/m*min^2/psi
k2=1.75*10^-4*60^1.67*14.5/264.172^1.67; %%psi/(gal/min)^1.67
k3=2.27*10^-2; %%(m^3/h)^.6/m^2
g=32.17; %%ft/s^2
rhoh20=62.4; %%lbs/ft^3
pf=rhoh20*g*PH*1.488*.000145; %%psidelpo=pf-po; %%psiicQ=qo; %%gpmicdelp=delpo; %%psifunction dydx=odes(jw,a1,k2)dydx=zeros(2,1);dydx(1)=-jw*a1;dydx(2)= -k2*y(1)^1.67;end function F=JW(lp,qo,delpio,k3,y)F=lp*(y(2)-qo*delpio/y(1)*exp(z/(k3*y(1)^0.40))-z; end xo=0;X=@JWjw=fsolve(JW,xo);xspan=[0 50];[x,y]=ode45(@odes,xspan,[icQ icdelp]);Error in fsolve (line 242) fuser = feval(funfcn{3},x,varargin{:});Error in mhlro (line 24)jw=fsolve(@(z)JW(lp,qo,delpio,k3,y),xo);Caused by: Failure in initial objective function evaluation. FSOLVE cannot continue.
FIrst is my function of differntial equations
followed by my function that i want to fsolve.
I want to find the number z in the equation but that equation is dependent on the differential equations and the differentials are depenedent on z.
The error i get is below.
Best Answer