Matlab Resistance (size mismatch error)
I need to use matlab to find a convolution in the range 0 <= n <= 20.
x [n] = δ [n] + δ [n-2] and h [n] = 2 * (3 ^ n) u [n]
I tried to do this and I was met with "X is not the same length as Y" when trying to build it and tried to fix it. Can anyone inform me if this is correct?
n = [0:20];
x =[1 0 1];
h= 2*3.^n;
y = conv(x,h);
ysize = size(y,2)
z = [0:(ysize-1)];
ysize = size (y,2);
p = stem(z ,y ,'r' ,'filled');
set (p, 'LineWidth', 2, 'MarkerSize', 4);
title ('y[n] = x[n] * h[n]');
xlabel ('n');
ylabel ('y[n]');
+3
source to share