Hello I am having trouble plotting this convolution. my error is "Vectors must be the same length."

if true
% code
end
n= -60:60;
xn= cos(n/10);
h = zeros(size(n));
h(abs(n)<=10) = 1/21;
xn1= conv(xn,h);
plot(n,xn1);

3 Comments

Are you sure n is defined correctly? It looks like you're trying to make an array, but you're making a scalar.
its suppose to be -60 to 60. and I have cov instead of conv, though it is still not working.

Sign in to comment.

Answers (1)

Use conv for convolution. cov computes the covariance matrix.

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 8 Sep 2016

Commented:

on 9 Sep 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!