0% found this document useful (0 votes)
473 views4 pages

Experiment-3: %linear Convolution Using Circular Convolution

The document describes an experiment to perform linear convolution using circular convolution and vice versa using MATLAB. It discusses how linear convolution of two sequences produces an output of length L+M-1, while circular convolution produces an output of length N, where N is the maximum of L and M. The experiment involves padding the shorter sequence with zeros to perform circular convolution, and calculating linear convolution by summing multiplied pairs of the wrapped sequences. Graphs are produced and compared between the input sequences and output of both methods.

Uploaded by

FAIZ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
473 views4 pages

Experiment-3: %linear Convolution Using Circular Convolution

The document describes an experiment to perform linear convolution using circular convolution and vice versa using MATLAB. It discusses how linear convolution of two sequences produces an output of length L+M-1, while circular convolution produces an output of length N, where N is the maximum of L and M. The experiment involves padding the shorter sequence with zeros to perform circular convolution, and calculating linear convolution by summing multiplied pairs of the wrapped sequences. Graphs are produced and compared between the input sequences and output of both methods.

Uploaded by

FAIZ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

SHIVAM 00970211219 MET

EXPERIMENT-3

AIM: Perform linear convolution using circular convolution and vice

versa. APPARATUS USED: MATLAB Software

THEORY: Consider two finite duration sequences x(n) and h(n) of duration L samples
and M samples. The linear convolution of these two sequences produces an output
sequence of duration L+M-1 samples, whereas, the circular convolution of x(n) and h(n)
give N samples where N=max(L, M).In order to obtain the number of samples in circular
convolution equal to L+M-1, both x(n) and h(n) must be appended with appropriate
number of zero valued samples. In other word by increasing the length of the sequences
x(n) and h(n) to L+M-1 points and the circularly convolving the resulting sequences we
obtain the same result as that of linear convolution.

PROGRAM:
%linear convolution using circular convolution
x=input('first sequence to be convoluted');
h=input('second sequence to be convoluted');
N1=length(x);
N2=length(h);
n1=0:N1-1;
n2=0:N2-1;
subplot(3,1,1);
stem(n1,x);
xlabel('time');
ylabel('Amplitude');
title('first sequence x(n)');
subplot(3,1,2);
stem(n2,h);
xlabel('time');
ylabel('Amplitude');
title('seconf sequence h(n)');
if N1>N2
N3=N1-N2;
h=[h,zeros(1,N3)];
elseif N2>N1
N3=N2-N1;
x=[x,zeros(1,N3)];
end
N=N1+N2-1;
y=cconv(x,h,N);
n3=0:N-1;
subplot(3,1,3);
stem(n3,y);
xlabel('time');
ylabel('amplitude');
SHIVAM 00970211219 MET
title('circular convolution sequence');
OUTPUT

:
GRAPH:
SHIVAM 00970211219 MET

PROGRAM:
% Perform circular convolution using linear convolution
x=input('first sequence');
h=input('second sequence');
N1=length(x);
N2=length(h);
n1=0:N1-1;
subplot(3,1,1);
stem(n1,x);
xlabel('Time');
ylabel('Amplitude');
title('First sequence response x(n)');
n2=0:N2-1;
subplot(3,1,2);
stem(n2,h);
xlabel('Time');
ylabel('Amplitude');
title('Second sequence response h(n)');
N=N2+N2-1;
if N1>N2
N3=N1-N2;
h=[h,zeros(1,N3)];
elseif n2>n1
N3=N2-N1;
x=[x,zeros(1,N3)];
end
x=[x,zeros(1,N-N1)];
h=[h,zeros(1,N-N2)];
for n=1:N
y(n)=0;
for i=1:n
j=n-i+1;
if(j<=0)
j=n+j;
end
y(n)=y(n)+x(i)*h(j);
end
end
disp('circular convolution of x&h is'); disp(y);
n3=0:N-1;
subplot(3,1,3);
stem(n3,y);
xlabel('Time');
ylabel('Amplitude');
title('Circular convoluted sequence response');
SHIVAM 00970211219 MET
OUTPUT:

GRAPH:

You might also like