|
My earlier response requires some clarification:
There is an obvious sine solution which is y = (M/(-w*w+g))*sin(wt).
But this only works if you form the ODE by differentiating twice, in which case
y" = (-M*w*w/(-w*w+g))*sin(wt) and hence y"+gy = Msin(wt).
(This only works if w*w is not equal to g, so doesn't allow for my previous solution which assumed w = g = M =1.)
However, if you start with the above y" and integrate it twice to get y, which is what Simulink does if you feed that as an input into 2 cascaded integrator blocks, then due to the constant of integration you do not get that y"+gy = Msin(wt).
You do however get y"+gy = Msin(wt) if you set the initial condition of the first integrator (the one going from y" to y') to be M/(w*w+g).
This removed the offset from y' that is introduced by the constant of integration.
Phil.
"Phil Goddard" <philgoddardNOSPAM@telus.net> wrote in message <gjeet9$479$1@fred.mathworks.com>...
>
> 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.
|