Error with conv function. Using discrete functions but I keep getting an error.
显示 更早的评论
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.
采纳的回答
更多回答(1 个)
Walter Roberson
2017-12-22
Change
a = conv(y,y)
to
a = conv(y,y,'same');
类别
在 帮助中心 和 File Exchange 中查找有关 Correlation and Convolution 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!