Professional Documents
Culture Documents
Convolution
OBJECTIVES:
EQUIPMENT:
Personal Computer
MATLAB
DISCUSSION:
INTRODUCTION:
The response y(n) of the LTI system as a function of the input signal x(n) and the unit
sample (impulse) response h(n) is a convolution sum between x(n) & h(n). The input x(n)
is convolved with the impulse response h(n) to yield the output y(n).
y(n) x(k)h(n k)
k
1
Example of Convolution in MATLAB:
2
ylabel('amplitude');
title('sinusoidal signal');
subplot(3,1,2);
plot(t,h,'r');
xlabel('time');
ylabel('amplitude');
title('square function');
y=conv(x,h);
subplot(3,1,3);
plot(y);
xlabel('time');
ylabel('amplitude');
title('convolution signal');
clc;
clear all;
close all;
L=input('enter the length of 1st sequence');
M=input('enter the length of 2nd sequence');
x=input('enter the first sequence:x(n)=');
h=input('enter the second sequence:y(n)=');
N=0:(L+M-1);
y=conv(x,h);
subplot(3,1,1);
stem(x,'g');
xlabel('discrete time');
ylabel('x(n)');
title('1st sequence');
subplot(3,1,2);
stem(h,'r');
xlabel('discrete time');
ylabel('h(n)');
title('second sequence');
subplot(3,1,3);
stem(y);
xlabel('discrete time');
ylabel('y(n)');
title('convolution of two sequences');
%%%
enter the first sequence:x(n)=[1 2 3 4]
enter the second sequence:y(n)=[1 2 3 4]
%%%
3
LAB TASK: