Impulse Response using Dirac(t)

33 views (last 30 days)
Consider the following code segment used to generate the step response
syms y t
y=dsolve('D2y+5*Dy+6*y=heaviside(t)','y(0)=0','Dy(0)=0','t');
Now, the impulse response can be determined (and plotted) using
ir = diff(y);
subplot(211)
ezplot(ir,[0,5]);
title('Impulse response from Step reponse');
However, when I try to find (and plot) the impulse response using the following code, it gives the same shape as before, but with (almost) half the magnitude.
x=dsolve('D2y+5*Dy+6*y=dirac(t)','y(0)=0','Dy(0)=0','t');
subplot(212)
ezplot(x,[0,5]);
title('Impulse response From dirac')
Although I personally think that the answer must be the same, can anyone explain why it isn't the case??

Accepted Answer

Teja Muppirala
Teja Muppirala on 16 Oct 2011
I think this is a very good question. Here is my explanation, but maybe someone can give a better one.
In this equation:
dsolve('D2y+5*Dy+6*y=dirac(t)','y(0)=0','Dy(0)=0','t');
Dy is actually discontinuous at the origin. The way the initial conditions are interpreted is that Dy(0) means the average of Dy(0+) and Dy(0-).
Here (0+) means the limit from the positive side, (0-) means the limit from the negative side. If you look at x around the origin, you will indeed see that the derivative is actually discontinuous at the origin. At (0-) it is negative, and at (0+) it is positive with the same magnitude so that the AVERAGE value is zero, It's a little different than how it is defined for Laplace transforms, where initial conditions are taken at (0-).
Try this for example:
dsolve('Dy = dirac(t)', 'y(0) = 0')
And you will see that it is not exactly the step function, but rather a step function that is shifted down by one half to make the average value at y(0) = 0.
ans = heaviside(t) - 1/2
In fact these two evaluate to be the same:
dsolve('D2y+5*Dy+6*y=dirac(t)','y(0)=0','Dy(0)=0','t');
diff(dsolve('D2y+5*Dy+6*y=heaviside(t)-1/2','y(0)=0','Dy(0)=0','t'));
Note, also, that the following two expressions where I simply added a delay will also give you the same answers, because in this case there is no discontinuity at the t = 0 and the initial conditions are in agreement regardless of which definition you use:
dsolve('D2y+5*Dy+6*y=dirac(t-1)','y(0)=0','Dy(0)=0','t');
diff(dsolve('D2y+5*Dy+6*y=heaviside(t-1)','y(0)=0','Dy(0)=0','t');
  2 Comments
Ultrazord
Ultrazord on 17 Oct 2011
Nice one.
So, I'm inferring that there is no workaround for the differential equation with the delta function, given that the delay is 0.
Is it so???
Teja Muppirala
Teja Muppirala on 17 Oct 2011
There is a very easy workaround. Use limits to enforce your boundary conditions:
x = dsolve('D2y+5*Dy+6*y=dirac(t)','y(e)=0','Dy(e)=0','t');
x = limit(x,'e',0,'left')
ezplot(x,[-1 5])

Sign in to comment.

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!