<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241732</link>
    <title>MATLAB Central Newsreader - Solving 2nd order ode in Simulink</title>
    <description>Feed for thread: Solving 2nd order ode in Simulink</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 30 Dec 2008 19:03:03 -0500</pubDate>
      <title>Solving 2nd order ode in Simulink</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241732#619308</link>
      <author>Emeka Obe</author>
      <description>Hello,&lt;br&gt;
&lt;br&gt;
It looks like if one cascades two integrators, he does not get a 2nd order ode solved.&lt;br&gt;
&lt;br&gt;
For example, my 2n order ode is:&lt;br&gt;
&lt;br&gt;
y'' + gy = Msin(wt). &lt;br&gt;
&lt;br&gt;
g is a constant. &lt;br&gt;
&lt;br&gt;
The solution to this ode shd be a sine function. When I cascade two integrators, I do not see a sine function resulting in simulink. Why?&lt;br&gt;
&lt;br&gt;
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)?&lt;br&gt;
&lt;br&gt;
Can someone provide a solution to these?&lt;br&gt;
&lt;br&gt;
ES</description>
    </item>
    <item>
      <pubDate>Wed, 31 Dec 2008 00:38:01 -0500</pubDate>
      <title>Re: Solving 2nd order ode in Simulink</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241732#619336</link>
      <author>Phil Goddard</author>
      <description>&lt;br&gt;
You need to revise the fundamentals of integration:&lt;br&gt;
&lt;br&gt;
&amp;gt; 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)?&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
So for u = sin(t), integrated from t0=0, the integral is 1-cos(t).&lt;br&gt;
Not surprisingly this is what Simulink gives.&lt;br&gt;
&lt;br&gt;
&amp;gt; For example, my 2n order ode is:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; y'' + gy = Msin(wt). &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; g is a constant. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The solution to this ode shd be a sine function.&lt;br&gt;
&lt;br&gt;
I can't think of a case where the solution is a pure sine wave.&lt;br&gt;
For the (easy) case of g = M = w = 1 the solution is y = -0.5 * t * cos(t).&lt;br&gt;
Again, not surprisingly this is what Simulink gives.&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
Phil.</description>
    </item>
    <item>
      <pubDate>Wed, 31 Dec 2008 08:19:04 -0500</pubDate>
      <title>Re: Solving 2nd order ode in Simulink</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241732#619361</link>
      <author>Phil Goddard</author>
      <description>&lt;br&gt;
My earlier response requires some clarification:&lt;br&gt;
&lt;br&gt;
There is an obvious sine solution which is y = (M/(-w*w+g))*sin(wt).&lt;br&gt;
But this only works if you form the ODE by differentiating twice, in which case&lt;br&gt;
y&quot; = (-M*w*w/(-w*w+g))*sin(wt) and hence y&quot;+gy = Msin(wt).&lt;br&gt;
(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.)&lt;br&gt;
&lt;br&gt;
However, if you start with the above y&quot; 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&quot;+gy = Msin(wt).&lt;br&gt;
You do however get y&quot;+gy = Msin(wt) if you set the initial condition of the first integrator (the one going from y&quot; to y') to be M/(w*w+g).&lt;br&gt;
This removed the offset from y' that is introduced by the constant of integration.&lt;br&gt;
&lt;br&gt;
Phil.&lt;br&gt;
&lt;br&gt;
&quot;Phil Goddard&quot; &amp;lt;philgoddardNOSPAM@telus.net&amp;gt; wrote in message &amp;lt;gjeet9$479$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You need to revise the fundamentals of integration:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; 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)?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 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.&lt;br&gt;
&amp;gt; So for u = sin(t), integrated from t0=0, the integral is 1-cos(t).&lt;br&gt;
&amp;gt; Not surprisingly this is what Simulink gives.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; For example, my 2n order ode is:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; y'' + gy = Msin(wt). &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; g is a constant. &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; The solution to this ode shd be a sine function.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I can't think of a case where the solution is a pure sine wave.&lt;br&gt;
&amp;gt; For the (easy) case of g = M = w = 1 the solution is y = -0.5 * t * cos(t).&lt;br&gt;
&amp;gt; Again, not surprisingly this is what Simulink gives.&lt;br&gt;
&amp;gt; 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.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Phil.</description>
    </item>
  </channel>
</rss>

