[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 |
Dirk,
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)
y=x.*x;
endfunction
% Derivative function of the target. 2*x
function dydx = ableitung (y, x) %% <<you confused yourself with the
"t"
dydx = 2.*x; %% <<derivative of y=x*x
endfunction
% 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-')
Tschuess!
Paul Thomas
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------