Pass the answers of ode45 over to another function and solve the simultanous equation
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
clc, clear
a1=28*7*400; %%ft^2
po=40.6; %%psi
delpio=9; %%psi
qf=1525; %%gpm
qo=qf;
pp=16.4; %%psi
qp=1234; %%gpm
depr1=24.9; %%psi
delpr2=18.2; %%psi
PH=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; %%psi
delpo=pf-po; %%psi
icQ=qo;
icdelp=delpo;
xo=0;
xspan=[0 50];
jw=JW(lp,qo,delpio,k3,y,xo,z);
[x,y]=ode45(@odes,xspan,xo)
function F=JW(lp,qo,delpio,k3,y,xo,z)
F=fsolve(@findjw,xo);
function F=findjw(z)
F=lp*(y(2)-qo*delpio/y(1)*exp(z/(k3*y(1)^0.40)))-z;
end
end
function dydx=odes(jw,a1,k2)
dydx=zeros(2,1);
dydx(1)=-jw*a1;
dydx(2)= -k2*y(1)^1.67;
end
Undefined function or variable 'y'.
Error in mhlro (line 25)
jw=JW(lp,qo,delpio,k3,y,xo,z);
I would like to pass the solution from the ode 45 of function odes() over to function JW(). Both these equations are dependent of each other. i would like to solve for jw
2 Kommentare
Sriram Tadavarty
am 13 Mär. 2020
The error comes due to variable y not defined before the call to function JW. Please define y(1) before the function calls to JW and odes. This should solve.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!