0% found this document useful (0 votes)
232 views11 pages

DSP Lab 1 Solutions

This document contains solutions to 3 lab tasks: 1) Generating impulse, step, and ramp signals with given parameters using MATLAB code. 2) Generating various signals using unit step functions. 3) Finding the impulse and step responses of two discrete-time systems using MATLAB's filter function, with one system defined by y[n]= x[n] - 0.75y[n-1] and the other by y[n]= x[n] + 0.5x[n-1] + 0.75y[n-1] - 0.5y[n-2].

Uploaded by

telecomengg2010
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
232 views11 pages

DSP Lab 1 Solutions

This document contains solutions to 3 lab tasks: 1) Generating impulse, step, and ramp signals with given parameters using MATLAB code. 2) Generating various signals using unit step functions. 3) Finding the impulse and step responses of two discrete-time systems using MATLAB's filter function, with one system defined by y[n]= x[n] - 0.75y[n-1] and the other by y[n]= x[n] + 0.5x[n-1] + 0.75y[n-1] - 0.5y[n-2].

Uploaded by

telecomengg2010
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Solutions of Lab 1

Lab Task 1: Generate an impulse and a step signal with amplitude of 2 units and a ramp
signal with a slope of 2. Take an arbitrary time vector.
IMPULSE:
n=-1:.1:1;
imp=2*(n==0);
stem(n,imp)
axis([-3 +3 -3 +3])

STEP SIGNAL
n=-1:.1:1;
step=2*(n>=0);
stem(n,step)
axis([-3 +3 -3 +3])

RAMP SIGNAL
n=-1:.1:1;
step=2*(n>=0);
ramp=n.*step;
stem(n,ramp)

Lab Task 2: Generate the following signals:


i)
ii)
iii)
iv)

x[n]= u[n-5]
x[n]= u[n] - u[n-10]
x[n]= 2u[n] - r[n-2] + 4S[n-4]
x[n]= u[n-2] +2r [n-4] 4r[n-6] + 4r[n-8]- u[n-10]

Solution:
i)

n=0:.3:8;
u=(n>=5);
stem(n,u)
axis([-1 10 -1 +1])

ii)
n=0:.3:8;
u1=(n>=0);
u2=(n>=10);
x=u1-u2;
stem(n,x)
axis([-1 9 -.1 1.2])

iii)
n=0:.1:10;
u=(n>=0);
r=n.*u;
dr=r-2;
i=(n==4);
x=(2*u) - dr + (4*i);
stem(n,x)

iv)
n=0:.1:10;
u=(n>=2);
u1=(n>=0);
r1=n.*u1;
delr1=r1-4;
delr2=r1-6;
delr3=r1-8;
ut=(n==10)
x= (u) + (2*delr1) - (4*delr2) + (4*delr3) - ut
stem(n,x)

Lab Task 3: Find the impulse and step responses of the following discrete-time systems
a) y[n]= x[n] - 0.75y[n-1]
b) y[n]= x[n] + 0.5x[n-1] + 0.75y[n-1] - 0.5y[n-2]
Solution:
a)
IMPULSE RESPONSE:
n=0:.25:10;
Imp= n==0;
b=[1 0];
a=[1 0.75];
ImpRes= filter(b,a,Imp)
stem(n,ImpRes)
axis([-2 4.5 -1 +1])

STEP RESPONSE:
n=0:.25:10;
Step= n>=0;
b=[1 0];
a=[1 0.75];
StepRes= filter(b,a,Step)
stem(n,StepRes)
axis([-1 11 -.2 +1.2])

b)
IMPULSE RESPONSE:
n=0:.25:10;
Imp= n==0;
b=[1 0.5 0];
a=[1 -0.75 0.5];
ImpRes= filter(b,a,Imp)
stem(n,ImpRes)
axis([-2 4.5 -1 +1.8])

STEP RESPONSE:
n=0:.25:10;
Step= n>=0;
b=[1 0.5 0];
a=[1 -0.75 0.5];
StepRes= filter(b,a,Step)
stem(n,StepRes)
axis([-2 11 -1 +3])

You might also like