How to plot the results of a conv?
Show older comments
I keep getting the error "Error using stem (line 41)X must be same length as Y.". I am trying to plot the results of a conv function. Here's what I have:
if true
% code
n = -10:1:10;
x1 = [0 0 0 0 0 0 0 0 1 2 1 1 2 1 2 1 2 0 0 0 0];
h1 = [0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0];
y1 = conv(x1,h1);
figure
stem(n,y1)
xlim([-10,10]);
ylim([-5,5]);
end
I know it's something with the range of the vectors resulting from the conv function The code runs correctly and will calculate the convulsion but the graph will not display and I get the error message.
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D Plots 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!