Error with conv function. Using discrete functions but I keep getting an error.
Show older comments
Here's my Code
----
%f(n) = u(n) − u(n − 4);
x = -10:10;
y = (x >= 0) & (x < 4);
stem(x,y);
a_x = -10:10;
a=conv(y,y);
stem(a_x, a);
title('f(n) * f(n)');
-----
The error im getting is this ERROR;
Undefined function 'conv2' for input arguments of type 'char'.
Error in conv (line 40)
c = conv2(a(:),b(:),shape);
---
Also I'm running by section and line 40 is not within it. Plus when I comment out the conv function that I am calling the error disappears.
Accepted Answer
More Answers (1)
Walter Roberson
on 22 Dec 2017
Change
a = conv(y,y)
to
a = conv(y,y,'same');
Categories
Find more on Correlation and Convolution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!