MATLAB: How to calculate convolution

conv

i need help,i want to calculate the convolution of two discrete time signal but an error has occurred
n=-20:20;
delta=(n>=3 & n<=8);
x=delta;
% x denotes x[n]
delta=(n>=4 & n<=15);
h=delta;
% h denotes h[n]
subplot(3,1,1)
stem(n,x,'filled');
xlabel('n');
ylabel('Amplitude');
title('X[n]');
subplot(3,1,2)
stem(n,h,'filled');
xlabel('n');
ylabel('Amplitude');
title('h[n]');
subplot(3,1,3)
c=conv(x,h);
stem(n,c,'filled');
xlabel('n');
ylabel('Amplitude');
title('y[n]');
help me find the error in the coding…

Best Answer

conv() requires the inputs to be single or double, not logical.
Related Question