help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lsode question


From: Juan Pablo Carbajal
Subject: Re: lsode question
Date: Wed, 7 Dec 2011 01:20:49 +0100

On Tue, Dec 6, 2011 at 10:21 AM, dogan_79 <address@hidden> wrote:
> Hello, I am kind of new to Octave, I wrote the following code to solve the
> set of a diff. equations with lsode.
> The thing is it works for a different set of parameters like it gives result
> pretty fast for t = linspace(0,3.0,4000) but if I change it to t =
> linspace(0,3.2,4000) it takes forever to give anything, kind of freezes. Is
> this a bug or am I doing something wrong. The code is as follows:
>
> function vdot = func (v,t)
> g = 9.80;
> R = 10;
> mu = 0.8;
> vdot(1) = v(2);
> vdot(2) = (-1*g/R)*sin(v(1))-sign(v(2))*((g*mu/R)*cos(v(1))+mu*v(2)*v(2));
> endfunction
>
> v_0 = 0;
> R = 10;
> theta0 = 90;
> v0 = [theta0*3.141592654/180; v_0/R];
> t = linspace(0,3.0,4000);
> v = lsode ("func", v0, t);
> plot (t', v(1:4000,1))
>
> Thank you very much in advance,
> Dogan Erbahar
> Physics PhD canditate from Turkey
>
> --
> View this message in context: 
> http://octave.1599824.n4.nabble.com/lsode-question-tp4164020p4164020.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

Your dynamical system is quite nonlinear.
First, give just initial and final value to the time vector and let
lsode choose the discretization
t = [0 3] and t=[0 3.2].
Note that sine the period is longer and you are suing the same number
of steps you are indeed using a bigger time step fr the second case.

Second, Have you tried to plot the solutions you get as you approach
the end point 3.2?

Remember that the existence and uniqueness of a solution for a smooth
nonlinear system is defined on an interval of radius epsilon from the
initial condition, not necessarily for all times. Of course, this is
very system dependent.


-- 
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]