Linear Convolution of two signals |m file|

Linear convolution of two signals

Y(n)=X1(n)*X2(n)

Convolution is the mathematical method to combine two signals. It is used in signal processing filed.


MATLAB Program for two signals.



%Linear convolution of two signals

x1=input('Enter the first sequence x1(n)=');

x2=input('Enter the first sequence x2(n)=');

nx1=input('Enter the range of first sequence [-n:n]='); %starting point of the first sequence

nx2=input('Enter the range of second sequence [-n:n]='); %starting point of the 2nd sequence

nyb=nx1(1)+nx2(1);

nye=nx1(length(x1))+nx2(length(x2));

ny=[nyb:nye];

y=conv(x1,x2)

stem(ny,y);

Output


>> LinearConvolution

Enter the first sequence x1(n)=[1 2 3]

Enter the first sequence x2(n)=[1 2 3]

Enter the range of first sequence [-n:n]=[0:2]

Enter the range of second sequence [-n:n]=[0:2]

y =
     1     4    10    12     9


Figure:
Linear Convolution

No comments