The program code is :
clc
clear all
close all
X1=input('ENTER THE SEQUENCE 1 >');
i1=input('ENTER THE STARTING INDEX OF THE SEQUENCE 1 >');
X2=input('ENTER THE SEQUENCE 2 >');
i2=input('ENTER THE STARTING INDEX OF THE SEQUENCE 2 >');
m1=length(X1);
m2=length(X2);
Y=conv(X1,X2)
n1=i1:i1+m1-1;
n2=i2:i2+m2-1;
n3=(i1+i2):(i1+i2+length(Y)-1);
subplot(3,1,1)
stem(n1,X1,'r')
xlabel('n');
ylabel('Amplitude');
title('Sequence 1');
subplot(3,1,2)
stem(n2,X2,'g')
xlabel('n');
ylabel('Amplitude');
title('Sequence 2');
subplot(3,1,3)
stem(n3,Y,'c')
xlabel('n');
ylabel('Amplitude');
title('Linear Convolution of the Above two sequences');
output :
Please feel free to ask your questions in the comment session
clc
clear all
close all
X1=input('ENTER THE SEQUENCE 1 >');
i1=input('ENTER THE STARTING INDEX OF THE SEQUENCE 1 >');
X2=input('ENTER THE SEQUENCE 2 >');
i2=input('ENTER THE STARTING INDEX OF THE SEQUENCE 2 >');
m1=length(X1);
m2=length(X2);
Y=conv(X1,X2)
n1=i1:i1+m1-1;
n2=i2:i2+m2-1;
n3=(i1+i2):(i1+i2+length(Y)-1);
subplot(3,1,1)
stem(n1,X1,'r')
xlabel('n');
ylabel('Amplitude');
title('Sequence 1');
subplot(3,1,2)
stem(n2,X2,'g')
xlabel('n');
ylabel('Amplitude');
title('Sequence 2');
subplot(3,1,3)
stem(n3,Y,'c')
xlabel('n');
ylabel('Amplitude');
title('Linear Convolution of the Above two sequences');
output :
Please feel free to ask your questions in the comment session
Comments
Post a Comment