You are on page 1of 7

Departamento of Electrical and Computer Engineering

Universidad de Puerto Rico - Mayagez

Digital Signal Processing


Assignment 1

by
Student Name
Student ID

for
Prof. Vidya Manian
Department of Electrical and Computer Engineering
Universidad de Puerto Rico en Mayagez
manian@ece.uprm.edu

Date of Submission

Assignment 1: Basic Signal Generation


Due Date: October 2 2010 before 11:59PM

Introduccin:
This work introduces students to the basics of signal processing. Each student should do
the example and do the work individually.
Este documento debe ser entregado con las siguientes modificaciones e indicaciones:
1. Send copy of the document via email.
2. Write name, student ID number and date of submission in first page.
3. Modify each program as indicated.
4. Substitute the graphics with the ones you generated using the modified programs.
5. Show mathematical development (if any) of the results you have presented.

Problem No. P1: Unitary impulse sequence


Modify the following program in MATLAB for generating the signal, [n], n Z 32 ,
which is an unit impulse and substitute the following plot with the plot you obtained from
the modified program. Note that the plot should start from index 0 and terminate in index
31.
% Program P1
% Generation of a Unit Sample Sequence
clf;
% Generate a vector from -10 to 20
n = -10:20;
% Generate the unit sample sequence
u = [zeros(1,10) 1 zeros(1,20)];
% Plot the unit sample sequence
stem(n,u);
xlabel('Time index n');ylabel('Amplitude');
title('Unit Sample Sequence');
axis([-10 20 0 1.2]);
Unit Sample Sequence

1.2
1

Amplitude

0.8
0.6
0.4
0.2
0
-10

-5

5
Time index n

10

15

20

Problem No. P2: Complex exponential sequence


2

Modify the following program to plot the signal x[ n] A n4 e j 32 (2) n , n Z , which is the
32
product of two signals: one signal is complex periodic, with fundamental period of 8 ,
atenuated by a real exponential signal, with variable parameter 1 A 4 . Each student
should select a unique value of 1 A 4 and substitute the following plot with the plot
2

obtained from the modified program. Note that the signal x[n] A n4 e j 32 (2) n , n Z is
32
complex and plot its real and imaginary part.
% Program P2
% Generation of a complex exponential sequence
clf;
c = -(1/12)+(pi/6)*i;
K = 2;
n = 0:40;
x = K*exp(c*n);
subplot(2,1,1);
stem(n,real(x));
xlabel('Time index n');ylabel('Amplitude');
title('Real part');
subplot(2,1,2);
stem(n,imag(x));
xlabel('Time index n');ylabel('Amplitude');
title('Imaginary part');
Real part

Amplitude

1
0
-1
-2

10

15

10

15

Amplitude

20
25
Time index n
Imaginary part

30

35

40

30

35

40

1
0

-1

20
Time index n

25

Problem No. P3: Discrete real exponential sequence


2

Modify the following program to plot the signal x[n] e 1 36 (0.8) n , n Z , which is real
36
and exponential. Note that the signal decays over time.
% Program P3
% Generation of a real exponential sequence
clf;
n = 0:35; a = 1.2; K = 0.2;
x = exp(-(2*pi/36)*0.8*n);
stem(n,x);
xlabel('Time index n');ylabel('Amplitude');

120
100

Amplitude

80
60
40
20
0

10

15
20
Time index n

25

30

35

Problem No. P4: Sinusoidal discrete sequence


Modify the following program to plot the signal x[n] 1.5cos 2 ( 322 )n , n Z 32 , which
is a sinuoid, with fundamental period 16, and substitute the following plot with the plot
obtained from the modified program. The resultant plot should have 32 values only,
indexed uniformly, in unit increments in the x-axis and has 0 as the index of origin.
% Program P4
% Generation of a sinusoidal sequence
n = 0:40;
f = 0.1;
phase = 0;
A = 1.5;
arg = 2*pi*f*n - phase;
x = A*cos(arg);
clf;
% Clear old graph
stem(n,x);
% Plot the generated sequence
axis([0 40 -2 2]);
grid;
title('Sinusoidal Sequence');
xlabel('Time index n');
ylabel('Amplitude');
axis;
Sinusoidal Sequence

2
1.5

Amplitude

1
0.5
0
-0.5
-1
-1.5
-2

10

15

20
Time index n

25

30

35

40

Problem No. P4: Sinusoidal discrete sequence - Exercise M2.3 (from textbook page
115)