Path: news.mathworks.com!not-for-mail
From: "Phil Goddard" <philgoddardNOSPAM@telus.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Solving 2nd order ode in Simulink
Date: Wed, 31 Dec 2008 00:38:01 +0000 (UTC)
Organization: Goddard Consulting
Lines: 23
Message-ID: <gjeet9$479$1@fred.mathworks.com>
References: <gjdr97$b06$1@fred.mathworks.com>
Reply-To: "Phil Goddard" <philgoddardNOSPAM@telus.net>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1230683881 4329 172.30.248.37 (31 Dec 2008 00:38:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 31 Dec 2008 00:38:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 26433
Xref: news.mathworks.com comp.soft-sys.matlab:509281



You need to revise the fundamentals of integration:

> I also noticed that if one used a sine block (Msinwt) as input to an integrator, he gets the output of the integrator as M+Mcos(wt). Why not just Mcos(wt)?

The integral of a sine wave is the negative of a cosine plus a constant, where the value of the constant is the value of the cosine at t = t0.
So for u = sin(t), integrated from t0=0, the integral is 1-cos(t).
Not surprisingly this is what Simulink gives.

> For example, my 2n order ode is:
> 
> y'' + gy = Msin(wt). 
> 
> g is a constant. 
> 
> The solution to this ode shd be a sine function.

I can't think of a case where the solution is a pure sine wave.
For the (easy) case of g = M = w = 1 the solution is y = -0.5 * t * cos(t).
Again, not surprisingly this is what Simulink gives.
For the more generic case y will be something like a*sin(wt) + b*cos(wt) where a and b are functions of g, M and w.

Phil.