Instead of solving by MATLAB built in function conv make your own 1-D convolution function
Source code:
x=input('INPUT THE SIGNAL of x[n] in the form [x,x,x,x,x,x]:');
h=input('INPUT THE SIGNAL of h[n]\ in the form [x,x,x,x,x,x]:');
m=length(x);
n=length(h);
X=[x,zeros(1,n)];
H=[h,zeros(1,m)];
for i=1:n+m-1
Y(i)=0;
for j=1:m
if(i-j+1>0)
Y(i)=Y(i)+X(j)*H(i-j+1);
else
end
end
end
subplot(3,1,1)
stem(X)
xlabel('Time');
ylabel('Amplitude');
title('x[n]');
subplot(3,1,2)
stem(H)
xlabel('Time');
ylabel('Amplitude');
title('h[n]');
subplot(3,1,3)
stem(Y);
ylabel('Amplitude');
xlabel('Time');
title('output Y[n] [1-D Convolution Function]');
Result:
0 Comments