From: "Peter " <>
Newsgroups: comp.soft-sys.matlab
Subject: ode45 problems
Date: Sun, 3 Jul 2011 22:17:10 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <iuqpp6$917$>
Reply-To: "Peter " <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1309731430 9255 (3 Jul 2011 22:17:10 GMT)
NNTP-Posting-Date: Sun, 3 Jul 2011 22:17:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2419300
Xref: comp.soft-sys.matlab:734740

I'm new to using ode functions in matlab. I've got the basic stuff working but have found something strange.

Here is my core function:

function dxdt = harm1(tr,xr)
    % Simple harmonic oscillator from Thompson & Stewart
    dxdt = [xr(2); -4*pi^2*sin(xr(1))];

It is an undamped, unforced pendulum. The result should maintain the same amplitude (???) I have 2 results from 2 initial conditions.

As I extend the time series (e.g. to 500 secs) I find that one of the results shows a very significant reduction in amplitude, and the other shows a small increase in amplitude. (The reason for running a long time series - apart from just curiosity - is to get a clear fft plot).

The starting conditions are x=1.5, dx/dt=0; x=1.55, dx/dt=0

The amplitude of condition 1 at the start is, of course, 1.5 - but at 500 secs is 0.93.
The amplitude of condition 2 at the start is 1.55 - and at 500 secs is 1.59

My phase plot (x vs dx/dt) shows clear gradual decline in amplitude of condition 1 and clear gradual increase of condition 2.

Is this an ode45 issue? Is there something I need to do with long time series?

Any help would be appreciated, thanks.