help-octave
[Top][All Lists]
Advanced

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

Re: lsode question


From: Thomas Shores
Subject: Re: lsode question
Date: Tue, 06 Dec 2011 23:28:24 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0

On 12/06/2011 06:20 PM, Juan Pablo Carbajal wrote:
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.


Interestingly enough, 3 < pi < 3.2.  More to the point, the critical
points for this nonlinear system are easily seen to be [0; k*pi/2], k
any integer.  You start the system at a non-critical point (that's good)
and seem to stall.  This suggests to me that the limiting solution
(possibly as t approaches pi) approaches a critical point that is a sink,
i.e., the Jacobian of the system at this point has negative eigenvalues.
You might check your solution and see if it approaches some critical
point of the form [0; k*pi/2], and also calculate the eigenvalues numerically
for the solution as t approaches pi. If they are negative,  this explains
the stalling.

Thomas Shores



reply via email to

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