Extract value from function
Show older comments
Hello friends, I have this code that return values for dc1dt and dq1dt. But I want to see the values for dc1dz, how can I do that?
function dydt=f(t,y,R,P,epsb,u,LDF1,b1,qm1,c10,Nz,dz,rhop,nco2,T)
dydt=zeros(length(y),1);
dc1dt=zeros(Nz,1);
dq1dt=zeros(Nz,1);
%Assign values
c1=y(1:Nz);
q1=y(Nz+1:2*Nz);
%BC
c1(1)=c10;
c1(end)=(4*c1(end-1)-c1(end-2))./3;
%interior
for i=2:Nz-1
dc1dz(i)=(c1(i+1)-c1(i-1))./(2.*dz);
q1star(i)=qm1.*((b1.*0.197).^(1/nco2))./(1+(b1.*0.197).^(1/nco2));
dq1dt(i)=LDF1.*(q1star(i)-q1(i));
%main f
dc1dt(i)=-u*dc1dz(i)-(rhop.*R.*T./P *((1-epsb)./epsb).*dq1dt(i));
end
dydt=[dc1dt;dq1dt];
end
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!