help-octave
[Top][All Lists]

## How can I solve equation of motion?

 From: NIITSU Taichi Subject: How can I solve equation of motion? Date: Mon, 02 Dec 2002 18:04:33 +0900

```Dear all,

Now,I research to solve the equation of motion by using octave.
The following is the example of equations.

(dx/dt)''=F - (dx/dt)'

#"F" is the externalforce which is measured by experiment.This value is
refered to data of experiment every time.

I came up with the program to solve this equation as follows.
But,this program does not seem to work correctly.

F=rand(5,1);    # Now, I give randam "F"
function dx = ex(x,t)
global n;
dx(1) = F(n+1,1)-x(1);
dx(2) = x(1);
endfunction

global n;
v=0;    # set initial value
X=0;    # set initial value
for n=0:4
x0 = [v;X]      # initial value
t = linspace(n,n+1,2)
y = lsode("ex",x0,t)
v=(2,1)         # new initial value
X=(2,2)         # new initial value
end

I would be very happy if you have any idea on it and let me know

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Taichi Niitsu
http://www.mep.titech.ac.jp/Nakahara/home.html
TEL.03-5734-3091 / e-mail address@hidden

-------------------------------------------------------------
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
-------------------------------------------------------------

```

reply via email to