<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hello,<br>
<br>
Why use a cannon to kill a fly ? Maybe this would be easier like
this :<br>
<br>
function dvdt=f(t,v)<br>
dvdt=[0.01 -0.01;-0.01 0.01]*v;<br>
endfunction<br>
<br>
t=0:0.1:10;<br>
v=ode([10000;5000],0,t,f);<br>
plot(t,v)<br>
<br>
S.<br>
<br>
Le 15/09/2014 13:05, Berns Buenaobra a écrit :<br>
</div>
<blockquote
cite="mid:CAP4TTkHUQFko6UadrJcFx68zOEmXvEWten1yqw7XxcC-HFpBuw@mail.gmail.com"
type="cite">
<pre wrap="">You could simulate those in XCOS like an analog computation using
Differentiators and its inverse for the solution also multipliers by the
way.
Berns B.
On Sun, Sep 14, 2014 at 10:54 PM, Farid Afandiyev <a class="moz-txt-link-rfc2396E" href="mailto:faridafandiyev@gmail.com"><faridafandiyev@gmail.com></a>
wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Thanks Mehran! This is exactly what I want!
Kind regards,
Farid.
On Sun, Sep 14, 2014 at 4:04 PM, A Khorshidi <a class="moz-txt-link-rfc2396E" href="mailto:akhorshidi@live.com"><akhorshidi@live.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Farid Afandiyev wrote
</pre>
<blockquote type="cite">
<pre wrap="">It looks like this
dV1/dt = 0.01V1 - 0.01V2
dV2/dt = -0.01V1 + 0.01V2
V1(0) = 10000
V2(0) = 5000
I want to plot V1 and V2 against time t=[0:10]
</pre>
</blockquote>
<pre wrap="">
Hi;
You can use the scheme below to solve system of ODEs in Scilab:
//
function xdot = modelName(t,x)
xdot = f(t,x) // where xdot and x are vectors
endfunction
x0 = [x1(0) x2(0)... xn(0)]' // a vector of the initial conditions
t0 = initialTime // a scalar: initial time
tf = finalTime // a scalar: final time
t = linspace(t0, tf)// a vector: the times that you want a solution for
x = ode(x0,t0,t,modelName);
plot(t', [x(1,:); x(2,:); ... x($,:)]')
//
And to really answer your question:
function Vdot=model(t, V)
Vdot(1) = 0.01*V(1) - 0.01*V(2)
Vdot(2) = -0.01*V(1) + 0.01*V(2)
endfunction
V0=[10000 5000]';
t0=0;
t=0:0.1:10;
V = ode(V0,t0,t,model);
plot(t', [V(1,:); V(2,:)]')
HTH
Mehran
_
--
View this message in context:
<a class="moz-txt-link-freetext" href="http://mailinglists.scilab.org/Scilab-users-Fwd-Help-modeling-ODE-system-tp4031148p4031151.html">http://mailinglists.scilab.org/Scilab-users-Fwd-Help-modeling-ODE-system-tp4031148p4031151.html</a>
Sent from the Scilab users - Mailing Lists Archives mailing list archive
at Nabble.com.
_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<pre wrap="">
_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<pre wrap="">
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>