Rubrics name & number Marks
In-Lab Post-Lab
Engineeri R2: Use of Engineering Knowledge and follow
ng Experiment Procedures:
Knowledg Ability to follow experimental procedures, control variables,
e and record procedural steps on lab report.
R3: Interpretation of Subject Knowledge: Ability to
interpret and explain mathematical and/or visual forms,
including equations, diagrams, graphics, figures and tables.
Problem R5: Data/Evidence Measurements:
Analysis Ability to record raw data / evidence.
R6: Experimental Data Analysis:
Ability to interpret findings, compare them to values in the
literature, identify weaknesses and limitations.
Design R7: Implementing Design Strategy: Ability to execute a
solution taking into consideration design requirements and
pertinent contextual elements. [Block Diagram/Flow
chart/Circuit Diagram]
R8: Best Coding Standards:
Ability to follow the coding standards and programming
practices.
Modern R9: Understand Tools: Ability to describe and explain
Tools the principles behind and applicability of engineering
Usage tools.
R11: Tools Evaluation:
Ability to simulate the experiment and then using
hardware tools to verify the results.
Individual R12: Individual Work Contributions: Ability to carry
and out individual responsibilities.
Teamwork
R13: Management of Team Work:
Ability to appreciate, understand and work with
multidisciplinary team members.
TIME DOMAINSIGNAL ANLAYSIS
6.1OBJECTIVE
The main objective of this lab is to learn convolution. In theory we performed
convolution using mathematical formulas which is very difficult. Using MATLAB, we
can perform convolution through just a single command ‘conv’. The main objective of
labs is understanding and learning of convolution using MATLAB.
.
6.2IN-LAB TASKS
6.2.1 TASK1
Compute and plot the convolution y[n]=x[n]*h[n] by conv command, where:
clc stem(n,h,'fill','linewidth',2),gr
close all id on
clear all legend('h[n]=u[n-1]')
n=-3:3 xlabel('time n')
u1=[1 1 1 0 0 0 0] ylabel('h[n]')
a=(1/3).^-n axis([-3.3,3.3,-0.1,1.1])
x=a.*u1 y=conv(x,h)
subplot(3,1,1) l=length(x)+length(h)-1
stem(n,x,'fill','linewidth',2),gr subplot(3,1,3)
id on stem(0:l-
legend('x[n]=(1/3).^-n u[-n-1]') 1,y,'fill','linewidth',2),grid on
xlabel('time n') legend('Convolution sum')
ylabel('x[n]') xlabel('time n')
axis([-3.3,3.3,-0.1,0.5]) ylabel('y[n]')
h=[0 0 0 1 1 1 1] axis([-.3,12.3,-0.1,0.6])
subplot(3,1,2)
0.4 x[n]=(1/3). -n u[-n-1]
x[n]
0.2
-3 -2 -1 0 1 2 3
time n
1
h[n]=u[n-1]
h[n]
0.5
0
-3 -2 -1 0 1 2 3
time n
0.6
Convolution sum
0.4
y[n]
0.2
0 2 4 6 8 10 12
time n
6.2.2 TASK2
Compute and plot the convolution of following signals (by conv command)
and
clc
close all
clear all
xk=0:4;
30
x=[1 1 1 1 1] Convolution Sum
stem(xk,x,'fill','linewidth',
2) 25
hk=0:6
h=(1.5).^hk 20
stem(hk,h,'fill','linewidth',
2)
y[n]
15
y=conv(x,h)
l=length(x)+length(h)-1 10
stem(0:l-
1,y,'fill','linewidth',3),gri 5
d on
legend('Convolution Sum')
0
xlabel('time n') 0 1 2 3 4 5 6 7 8 9 10
time n
ylabel('y[n]')
axis([-.3,10.3,-0.1,30.6])
6.2.3 TASK3
Consider and LTI system with input x[n] and unit impulse response h[n]specified as
clc
close all
clear all
k=-6:6;
u=[0 0 0 0 0 0 1 1 1 1 1 1 1]
u1=[1 1 1 1 1 1 1 0 0 0 0 0 0] Convolution Sum
x1=(2).^k 2
x=x1.*u1
stem(k,x,'fill','linewidth',2) 1.5
h=u;
y[n]
stem(k,h,'fill','linewidth',2) 1
y=conv(x,h)
l=length(x)+length(h)-1 0.5
stem(0:l-
1,y,'fill','linewidth',3),grid on 0
0 5 10 15 20 25
legend('Convolution Sum') time n
xlabel('time n')
ylabel('y[n]')
axis([-.3,25.3,-0.1,2.3])
6.3POST-LAB TASKS
6.3.1 TASK2
Compute (by both procedures) and graph the convolution y[n]=x[n]*h[n] , where
clc
close all Convolution SUM
clear all 1
n=0:6
u1=n>=0 0.5
u2=n>=4
x=u1-u2
y[n]
0
d1=n==0
d2=n==2
-0.5
h=d1-d2
y=conv(x,h)
l=length(x)+length(h)-1 -1
stem(0:l-
0 1 2 3 4 5 6
1,y,'linewidth',3),grid on time n
axis([-.3,6,-1.3,1.3])
legend('Convolution SUM')
xlabel('time n')
ylabel('y[n]')
Method 2
clc
n=0:6 1.2 x[k]
k=0:6
u1=n>=0 1
u2=n>=4 0.8
x=u1-u2
d1=n==0 0.6
x[k]
d2=n==2
0.4
h=d1-d2
stem(k,x,'fill','linewidth',3),g 0.2
rid on
0
legend('x[k]')
axis([-0.3,6.3,-0.3,1.3]) -0.2
xalbel('time n') 0 1 2 3 4 5 6
ylabel('x[k]') time n
h[k] 1
h[k]
0.5
stem(k,h,'fill','linewidth',3),gr
id on
h[k]
0
legend('h[k]')
axis([-0.3,3,-1.3,1.3])
-0.5
xlabel('time n')
ylabel('h[k]')
-1
0 0.5 1 1.5 2 2.5 3
time n
h[-k]
h[-k]
1
0.5
stem(-
k,h,'fill','linewidth',3),grid on
h[-k]
0
legend('h[-k]')
axis([-2.3,0.3,-1.3,1.3]) -0.5
xlabel('time k')
ylabel('h[-k]') -1
-2 -1.5 -1 -0.5 0
time k
h[1-k] 1
h[1-k]
stem(1-
k,h,'fill','linewidth',3),grid on
0.5
legend('h[1-k]')
axis([-1.3,1.3,-1.3,1.3])
h[1-k]
0
xlabel('time k')
ylabel('h[1-k]')
-0.5
-1
-1 -0.5 0 0.5 1
time k
h[2-k] 1
h[2-k]
stem(2-
k,h,'fill','linewidth',3),grid on
0.5
legend('h[2-k]')
axis([-.3,2.3,-1.3,1.3])
h[2-k]
xlabel('time k') 0
ylabel('h[2-k]')
-0.5
-1
0 0.5 1 1.5 2
time k
h[3-k] 1
h[3-k]
stem(3-
k,h,'fill','linewidth',3),grid on
0.5
legend('h[3-k]')
axis([.3,3.3,-1.3,1.3])
h[3-k]
0
xlabel('time k')
ylabel('h[3-k]')
-0.5
-1
0.5 1 1.5 2 2.5 3
time k
h[4-k] 1
h[4-k]
stem(4-
k,h,'fill','linewidth',3),grid on
legend('h[4-k]') 0.5
axis([1.3,4.3,-1.3,1.3])
xlabel('time k')
h[4-k]
0
ylabel('h[4-k]')
-0.5
-1
1.5 2 2.5 3 3.5 4
time k
h[5-k] 1
h[5-k]
stem(5-
k,h,'fill','linewidth',3),grid on
legend('h[5-k]') 0.5
axis([2.3,5.3,-1.3,1.3])
xlabel('time k')
h[5-k]
0
ylabel('h[5-k]')
-0.5
-1
2.5 3 3.5 4 4.5 5
time k
h[6-k] 1
h[6-k]
stem(6-
k,h,'fill','linewidth',3),grid on
legend('h[6-k]') 0.5
axis([3.3,6.3,-1.3,1.3])
xlabel('time k')
h[6-k]
ylabel('h[6-k]')
-0.5
-1
3.5 4 4.5 5 5.5 6
time k