1. LINEAR CONVOLUTION AND CORRELATION
AIM: To verify Linear Convolution.
EQUIPMENTS: Software -- MATLAB 7.5
Learning Objectives: To make the students familiar with concept of discrete convolution
and correlation with the use of MATLAB.
THEORY: Convolution is a formal mathematical operation, just as multiplication, addition, and
integration. Addition takes two numbers and produces a third number, while convolution takes
two signals and produces a third signal. Convolution is used in the mathematics of many fields,
such as probability and statistics. In linear systems, convolution is used to describe the
relationship between three signals of interest: the input signal, the impulse response, and the
output signal.
In this equation, x1(k), x2(n-k) and y(n) represent the input to and output from the system
at time n. Here we could see that one of the input is shifted in time by a value every time it is
multiplied with the other input signal. Linear Convolution is quite often used as a method of
implementing filters of various types.
ALGORITHM:
1. Enter the input Sequence ,x having length=4
2. Enter the Impulse Sequence, h having length=4
3. Performing the Convolution, store the value in y
4. Plotting the Input Sequence.
5. Plotting the Impulse Sequence.
6. Plotting the Output Sequence.
PROGRAM:
%linear convolution program:
clc;
clear all;
close all;
disp('linear convolution program');
x=input('enter i/p x(n):');
m=length(x);
disp(m);
h=input('enter i/p h(n):');
n=length(h);
disp(n);
x=[x,zeros(1,n)];
subplot(2,2,1), stem(x);
title('i/p sequence x(n)is:');
xlabel('---->n');
ylabel('---->x(n)');grid;
h=[h,zeros(1,m)];
subplot(2,2,2), stem(h);
title('i/p sequence h(n)is:');
xlabel('---->n');
ylabel('---->h(n)');grid;
disp('convolution of x(n) & h(n) is y(n):');
y=zeros(1,m+n-1);
for i=1:m+n-1
y(i)=0;
for j=1:m+n-1
if(j
y(i)=y(i)+x(j)*h(i-j+1);
end
end
end
subplot(2,2,[3,4]),stem(y);
title('convolution of x(n) & h(n) is :');
xlabel('---->n');
ylabel('---->y(n)');grid;
disp(y);
%program for discrete Correlation
x=[1 2 3 4];
y=[2 3 4 5];
z=xcorr(x,y);
stem(z);
subplot(2,2,1),stem(x)
title(‘input sequence 1’)
subplot(2,2,2),stem(y)
title(‘input sequence 2’)
subplot(2,2,3),stem(z)
title(‘output sequence’)
ALGORITHM:
1 Enter the input Sequence ,x having length=4
2 Enter the Impulse Sequence, y having length=4
3 Performing the Correlation, store the value in y
4 Plotting the Output Sequence ,store in z.
No comments:
Post a Comment