Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Steps, Impulses, and Convolution of Functions: A Mathematica Notebook - Prof. Fred Garber, Assignments of Electrical and Electronics Engineering

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

Pre 2010

Uploaded on 08/18/2009

koofers-user-npt
koofers-user-npt 🇺🇸

10 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Steps, Impulses, and Convolution of Functions
Working Instructional Material Notebook
Copyright © 1998 by Fred Garber
Steps and Impulses
First, we load a package that defines the unit step function and the delta fumction:
In[3]:= << Calculus`DiracDelta`
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@0D
Out[4]= 1
Lets take a look at it:
In[110]:= Plot@UnitStep@tD,8t, -1, 10<, PlotRange -> 80, 1.5<D
2 4 6 8 10
0.2
0.4
0.6
0.8
1
1.2
1.4
Out[110]= Graphics
FunctConv.nb 1
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Steps, Impulses, and Convolution of Functions: A Mathematica Notebook - Prof. Fred Garber and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

Steps, Impulses, and Convolution of Functions

Working Instructional Material Notebook

Copyright © 1998 by Fred Garber

Steps and Impulses

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: