<div dir="ltr">Thanks Mehran! This is exactly what I want!<div><br></div><div>Kind regards,</div><div><br>Farid.<br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Sep 14, 2014 at 4:04 PM, A Khorshidi <span dir="ltr"><<a href="mailto:akhorshidi@live.com" target="_blank">akhorshidi@live.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Farid Afandiyev wrote<br>
> It looks like this<br>
> dV1/dt = 0.01V1 - 0.01V2<br>
> dV2/dt = -0.01V1 + 0.01V2<br>
> V1(0) = 10000<br>
> V2(0) = 5000<br>
><br>
> I want to plot V1 and V2 against time t=[0:10]<br>
<br>
Hi;<br>
<br>
You can use the scheme below to solve system of ODEs in Scilab:<br>
//<br>
function xdot = modelName(t,x)<br>
xdot = f(t,x) // where xdot and x are vectors<br>
endfunction<br>
<br>
x0 = [x1(0) x2(0)... xn(0)]' // a vector of the initial conditions<br>
t0 = initialTime // a scalar: initial time<br>
tf = finalTime // a scalar: final time<br>
t = linspace(t0, tf)// a vector: the times that you want a solution for<br>
<br>
x = ode(x0,t0,t,modelName);<br>
<br>
plot(t', [x(1,:); x(2,:); ... x($,:)]')<br>
//<br>
<br>
And to really answer your question:<br>
<br>
function Vdot=model(t, V)<br>
Vdot(1) = 0.01*V(1) - 0.01*V(2)<br>
Vdot(2) = -0.01*V(1) + 0.01*V(2)<br>
endfunction<br>
V0=[10000 5000]';<br>
t0=0;<br>
t=0:0.1:10;<br>
V = ode(V0,t0,t,model);<br>
plot(t', [V(1,:); V(2,:)]')<br>
<br>
HTH<br>
Mehran<br>
_<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://mailinglists.scilab.org/Scilab-users-Fwd-Help-modeling-ODE-system-tp4031148p4031151.html" target="_blank">http://mailinglists.scilab.org/Scilab-users-Fwd-Help-modeling-ODE-system-tp4031148p4031151.html</a><br>
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br>
</blockquote></div><br></div></div></div>