





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Instructions and examples on how to define and use the unit step function and delta function in mathematica, as well as how to perform convolutions of impulses and other functions. It includes various examples and homework problems.
Typology: Assignments
1 / 9
This page cannot be seen from the preview
Don't miss anything!
Copyright © 1998 by Fred Garber
First, we load a package that defines the unit step function and the delta fumction:
In[3]:= << CalculusDiracDelta
The "unitstep" just defined as "UnitStep[]", denoted by u(t) has a step of size unity at t=0. The default value of u(t) at t=0 is unity.
In[4]:= UnitStep @ 0 D Out[4]= 1
Lets take a look at it:
In[110]:= Plot @ UnitStep @ t D , 8 t, - 1, 10 < , PlotRange -> 8 0, 1.5 <D
Out[110]= Ö Graphics Ö
The delta function, or impulse function, just defined is usually defined as the limit of a sequence of functions that integrate to unity, but have increasing height and decreasing width.
In[5]:= Integrate @ DiracDelta @ t D , 8 t, - Infinity, Infinity <D Out[5]= 1
Remember the defining equation for the impulse function? We had (^) Ÿ-^ • •^ dH t - a L f H t L ‚ t = f H a L Here it is in the language of Mathematica :
In[6]:= Integrate @ DiracDelta @ t - a D f @ t D , 8 t, - Infinity, Infinity <D Out[6]= f@aD
Cool, huh? So how about when the impuls is on outside of the limits of integration?
In[7]:= Integrate @ DiracDelta @ t - 5 D f @ t D , 8 t, - 23, 4 <D Out[7]= 0
How about one of the homework problems:
In[8]:= Integrate A DiracDelta @ t - 3 D t
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ t , 8 t, - Infinity, Infinity <E
Out[8]= ÄÄÄÄÄÄÄÄ^103
Now, lets do a convolution of an impulse and a unit setp and define the result at y(t)
In[43]:= y @ t_ D : = Integrate @ DiracDelta @ t - tD UnitStep @tD , 8 t , - Infinity, Infinity <D
In[111]:= Lets look at the result
— Get::noopen : Cannot open Classic.nb.
In[64]:= Plot @8 f @ t D , h @ t D< , 8 t, - 1, 5 < , PlotRange -> 8 0, 3.5 <D
Out[64]= Ö Graphics Ö
In[65]:= y @ t_ D : = Integrate @ f @ t - tD h @tD , 8 t , - Infinity, Infinity <D
In[67]:= Plot @ y @ t D , 8 t, - 1, 5 < , PlotRange -> 8 0, 1.5 <D
Out[67]= Ö Graphics Ö
ü Example 2: Exponential * Rectangular pulse How about an exponential and a rectangular pulse. Here we go, with 3 e - t u(t) *2[u(t-1) - u(t-2)],
In[73]:= f @ t_ D : = 2 H UnitStep @ t - 1 D - UnitStep @ t - 2 DL h @ t_ D : = 3 Exp @- t D UnitStep @ t D
In[75]:= Plot @8 f @ t D , h @ t D< , 8 t, - 1, 5 < , PlotRange -> 8 0, 3.5 <D
Out[75]= Ö Graphics Ö
In[76]:= y @ t_ D : = Integrate @ f @ t - tD h @tD , 8 t , - Infinity, Infinity <D
In[81]:= Plot @ y @ t D , 8 t, - 1, 8 < , PlotRange -> 8 0, 5 <D
Out[81]= Ö Graphics Ö
ü Example 3: Boxy thing * Same Boxy thing How about this one, a convolution with itself:
ü Example 4: Big Box * Little Box How about this one, notice that f starts before t=0.
In[91]:= f @ t_ D : = H UnitStep @ t + 1 D - UnitStep @ t - 1 DL h @ t_ D : = 2 H UnitStep @ t D - UnitStep @ t - 4 DL
In[93]:= Plot @8 f @ t D , h @ t D< , 8 t, - 2, 5 < , PlotRange -> 8 0, 2.5 <D
Out[93]= Ö Graphics Ö
Now the convolution:
In[94]:= y @ t_ D : = Integrate @ f @ t - tD h @tD , 8 t , - Infinity, Infinity <D
In[95]:= Plot @ y @ t D , 8 t, - 2, 6 < , PlotRange -> 8 0, 5 <D
Out[95]= Ö Graphics Ö
ü Example 5: Box * Cosine We sort-of did this in class.
In[103]:= f @ t_ D : = Cos @ 2 p 5 t D UnitStep @ t D h @ t_ D : = 2 H UnitStep @ t D - UnitStep @ t - 1 DL
In[105]:= Plot @8 f @ t D , h @ t D< , 8 t, - 1, 2 < , PlotRange -> 8 - 2, 2.5 <D
Out[105]= Ö Graphics Ö
Now the convolution: