[Top][All Lists]

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

RE: Solving a trivial ODE with lsode?

From: THOMAS Paul Richard
Subject: RE: Solving a trivial ODE with lsode?
Date: Thu, 12 Feb 2004 17:16:11 +0100


Geraint's reply is correct.  However, I think that what you were meaning to
do was spoiled by confusing the dependent and independent variables.  The
following does what you were trying to do, I think:

cord_x = linspace(0, 20, 100);

% The "target" function is power(x,2)
function y = quadrat(x)

% Derivative function of the target. 2*x
function dydx = ableitung (y, x)         %% <<you confused yourself with the
  dydx = 2.*x;                           %% <<derivative of y=x*x

% fix value with x0 = 0 = ableitung(0) = quadrat(0) = cord_x[0]
x0 = [0];

% Do the work!
abl_y = lsode ("ableitung", x0, cord_x);

% and finally give me a plot!
plot(cord_x, quadrat(cord_x),'r',cord_x,
ableitung(abl_y,cord_x),'b-',cord_x, abl_y,'go-')


Paul Thomas

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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