0% found this document useful (0 votes)
2 views

Ex 1 linear and circular convolution

The document outlines an experiment to perform linear and circular convolution of two sequences using MATLAB. It includes the aim, required apparatus, algorithms for both types of convolution, and a MATLAB program to execute the calculations. The problem statement specifies the input sequences, and the output includes the results of the convolutions plotted in discrete form.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Ex 1 linear and circular convolution

The document outlines an experiment to perform linear and circular convolution of two sequences using MATLAB. It includes the aim, required apparatus, algorithms for both types of convolution, and a MATLAB program to execute the calculations. The problem statement specifies the input sequences, and the output includes the results of the convolutions plotted in discrete form.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Ex.No.

1 LINEAR CONVOLUTION AND CIRCULAR


CONVOLUTION OF TWO SEQUENCES

AIM:
To write a program to perform the Linear convolution and to verify using MATLAB.

APPARATUS REQUIRED:
PC with MATLAB software

ALGORITHM:
LINEAR CONVOLUTION
1. Start
2. Get the two input sequences.
3. Obtain the linear convolution of two sequences.
4. Calculate the lengths of input sequences.
5. Assign the length of resultant sequence(N) equal to length of first sequence (L) +
length of second sequence (M) – 1 (N = L + M – 1).
6. Plot the input sequences and output sequence in discrete form corresponding to
their lengths.
7. Label the x and y axes.
8. Display the resultant sequence values.
9. Stop
CIRCULAR CONVOLUTION
1. Start
2. Get the two input sequences.
3. Check the maximum length (N) of two sequences.
4. By zero padding, make both the two sequences with equal length (N).
5. Calculate circular convolution of equal length sequences.
6. Plot the input sequences and output sequence in discrete form corresponding to their
lengths.
7. Label the x and y axes.
8. Display the resultant sequence values.
9. Stop
PROCEDURE:
1. Get two signals x(n) and h(n) in matrix form.
2. The convolute signal is denoted as y(n).
3. y(n) is given by the formula
y(n) = x(k)h(n-k)
4. n = length(X) returns the size of the longest dimension of X. If X is a vector, this is

the same as its length.


5. w = conv(u,v) convolves vectors u and v. Algebraically, convolution is the same
operation as multiplying the polynomials whose coefficients are the elements of u
and v. [subplot divides the current figure into rectangular panes that are numbered
row wise]
6. Stop the program
PROBLEM STATEMENT:

Determine the linear and circular convolution of the sequence

x(n) = {2,1,2,1) and y(n) = {1,2,3)


PROGRAM:
%Determine the linear and circular convolution of the sequences
%x(n) = {2,1,2,1} and y(n) = {1,2,3}
clc;
clear;
disp('First sequence')
x=[2 1 2]
disp('second sequence')
y=[1 2 3]
disp('linear convolution')
clin=conv(x,y)
xpad = [x zeros(1,6-length(x))];
ypad = [y zeros(1,6-length(y))];
disp('circular convolution')
ccirc = ifft(fft(xpad).*fft(ypad));
subplot(211)
stem(clin,'markerfacecolor',[0 0 1]);
title('Linear Convolution of x and y');
set(gca,'ylim',[0 11]);
subplot(212)
stem(ccirc,'markerfacecolor',[0 0 1]);
set(gca,'ylim',[0 11]);
title('Circular Convolution of xpad and ypad');
N = length(x)+length(y)-1;
xpad = [x zeros(1,12-length(x))];
ypad = [y zeros(1,12-length(y))];
ccirc = ifft(fft(xpad).*fft(ypad));
ccirc = ccirc(1:N);
ccirc2 = cconv(x,y,6);

OUTPUT:

You might also like