Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

AKSHIT SHARMA

00910402813
EXPERIMENT 9

AIM : Write a MATLAB code to perform linear convolution using circular convolution.
APPARATUS : MATLAB
THEORY : Linear convolution is the basic operation to calculate the output for any linear time
invariant system given its input and its impulse response.

Circular convolution is the same thing but considering that the support of the signal is
periodic (as in a circle).
Most often it is considered because it is a mathematical consequence of the discrete Fourier
transform (or discrete Fourier series to be precise):

One of the most efficient ways to implement convolution is by doing multiplication in the
frequency.

Sampling in the frequency requires periodicity in the time domain.

However, due to the mathematical properties of the FFT this results in circular
convolution.
If the sequences are not padded with (a sufficient number of) zeros you cannot retrieve the linear
convolution. If the sequences are padded with zeros the linear convolution is identical to (a part
of) the circular convolution. This property is used to calculate the linear convolution more
efficiently, by calculating he circular convolution, which in turn can be calculated very efficiently
in the frequency domain using the FFT algorithm.
Instead of padding with zeros you may as well pad with something else, as long as you know it
(it's deterministic). A common alternative would be the cyclic prefix (artificially periodify) used
in OFDM.

MATLAB CODE :
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.

clc;
close all;
clear all;
x1=input('enetr the first sequence');
x2=input('enetr the second sequence');
n=input('enter the no of points of the dft');
subplot(3,1,1);
stem(x1,'filled');
title('plot of first sequence');
subplot(3,1,2);
stem(x2,'filled');
title('plot of second sequence');
n1=length(x1);
n2=length(x2);
m=n1+n2-1;

AKSHIT SHARMA
00910402813
16. x=[x1 zeroes(1,n2-1)];
17. y=[x2 zeroes(1,n1-1)];
18. x_fft=fft(x,m);
19. y_fft=fft(y,m);
20. dft_xy=x_fft.*y_fft;
21. y=ifft(dft_xy,m);
22. disp('the circular convolution result is:');
23. disp(y);
24. subplot(3,1,3);
25. stem(y,'filled');
26. title('plot of circularly convoluted sequence');
OUTPUT :
Enter the first sequence : [1 2 1 2 1 2]
Enter the second sequence : [1 2 3 4]

RESULT : Linear convolution has been performed.

You might also like