Student Seminar Report & Project Report With Presentation (PPT,PDF,DOC,ZIP)

Full Version: 3. LINEAR CONVOLUTION OF TWO SEQUENCES
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Procedure:-
1. Read the input sequence, x[n] and plot
2. Read the impulse response of the system, h[n] and plot
3. Convolve the two results and plot them
Description:-
Linear Convolution involves the following operations.
1. Folding
2. Multiplication
3. Addition
4. Shifting
These operations can be represented by a Mathematical Expression as follows:
y[n] =  x[k]h[n-k]

x[ ]= Input signal Samples
h[ ]= Impulse response co-efficient.
y[ ]= Convolution output.
n = No. of Input samples
h = No. of Impulse response co-efficient.

Eg: x[n] = {1, 2, 3, 4}
h[k] = {1, 2, 3, 4}

Where: n=4, k=4. : Values of n & k should be a multiple of 4.
If n & k are not multiples of 4, pad with zero’s to make
multiples of 4
r= n+k-1 : Size of output sequence.
= 4+4-1
= 7.
r= 0 1 2 3 4 5 6
n= 0 x[0]h[0] x[0]h[1] x[0]h[2] x[0]h[3]
1 x[1]h[0] x[1]h[1] x[1]h[2] x[1]h[3]
2 x[2]h[0] x[2]h[1] x[2]h[2] x[2]h[3]
3 x[3]h[0] x[3]h[1] x[3]h[2] x[3]h[3]
Output: y[r] = { 1, 4, 10, 20, 25, 24, 16}.
MATLAB program for linear convolution
Code:
clear
clc
close all
% FIRST SEQUENCE IS X WITH TIME INDEX NX
x = [1 2 3 4];
nx =0:3;
% SECOND SEQUENCE IS H WITH TIME INDEX NH
h = [1 2 3 4];
nh =0:3;
% CONVOLUTION RESULT
y = conv(x,h);
% CORRESPONDING TIME INDEX CALCULATION
ny = [nx(1) + nh(1) : nx(length(x)) + nh(length(h))];

% PLOT THE TWO SEQUENCES AND THE CORRESPONDING CONVOLUTION OUTPUT
subplot(3,1,1);
stem(nx,x);
xlabel('n-->');
ylabel('x-->');
title('First Sequence');
grid on;

subplot(3,1,2);
stem(nh,h);
xlabel('n-->');
ylabel('h-->');
title('Second Sequence');
grid on;


subplot(3,1,3);
stem(ny,y);
xlabel('n-->');
ylabel('y-->');
title('Linear Convolved Sequence');
grid on;

disp('First Sequence is    :'); x
disp('Time  index is    :'); nx
disp('Second sequence is   :'); h
disp('Time index is     :'); nh
disp('Linear Convolution is:'); y
disp('Time index is        :'); ny

RESULT: - LINEAR CONVOLUTION OF TWO SEQUENCES
[attachment=13327]