[Scilab-users] Fwd: Help modeling ODE system

Berns Buenaobra berns.buenaobra at gmail.com
Mon Sep 15 13:05:55 CEST 2014


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 <faridafandiyev at gmail.com>
wrote:

> Thanks Mehran! This is exactly what I want!
>
> Kind regards,
>
> Farid.
>
>
> On Sun, Sep 14, 2014 at 4:04 PM, A Khorshidi <akhorshidi at live.com> wrote:
>
>> Farid Afandiyev wrote
>> > 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]
>>
>> 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:
>> http://mailinglists.scilab.org/Scilab-users-Fwd-Help-modeling-ODE-system-tp4031148p4031151.html
>> Sent from the Scilab users - Mailing Lists Archives mailing list archive
>> at Nabble.com.
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
>


-- 
Bernardino (Berns) Jerez Buenaobra
Senior Science Research Specialist
Data Processing Component
USC DOST-UP/NEC Project LiDAR (Light Detection and Ranging)
for Disaster Risk Exposure Assessment for Mitigation (DREAM)
University of San Carlos (Talamban Campus)
Contact information:
Mobile: +639054732772
Office: +63323464614
Google+ berns.buenaobra at gmail.com
Skype ID: poormanphysics
Professional Reference, Research and Education link:
http://ph.linkedin.com/pub/bernardino-buenaobra/16/42/637
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140915/6269eb66/attachment.htm>


More information about the users mailing list