Scilab
Posts  1 - 1  of  1
XCharming
Hi!I have some difficulties to solve an ODE system with the ode function.I wrote the following code,returning me an error 15 (sub matrix incorrectly defined).I have tought it over but am still unable to have it work!
The equations are awful and non-linear but correctly written so don't bother to pay them too much attention.
Thank you,
XCharming

function yp=system(t,y)
yp = zeros(y);
f1=y(1)*y(2)*y(3)/((Ksnh+y(1))*(Kso2+y(2)));
yp(1)=(-qmamo*f1)+((Q/V)*(Snho-y(1)));
yp(2)=(-(1-y)*qmamo*f1)+(klao2*(So2in-y(2))-b*y(3)-(Q*y(2)/V));
yp(3)=(qmamo*a*f1)-b*y(3)-(Q*y(3)/V);
yp(4)=(qmamo*f1)-qnirk*y(4)*Kso2*y(3)/((Ksno2+y(4))*(Kso2+y(2)))-(Q*y(4)/V);
yp(5)=(qnirk*y(1)*y(4)*Kio2*y(3)/((Ksno2+y(4))*(Ksnh+y(1))*(Kio2+y(2))))-(qnorb*y(5)*y(2)*y(3)/((Ksno+y(5))*(Kso2+y(2))))-(Q*y(5)/V);
yp(6)=(klano*V*y(5)/(14000*Khno*Vg))-(Qg*y(6)/Vg);
endfunction
t=linspace(0,500,1000);
y=ode([3;4;100;0.01;0.001;1e-20;0.001;1e-20],0,t,system);
clf;
for i=1:6
plot(t,y(i))
end
Save
Cancel
Reply
 
x
OK