【问题标题】:I keep getting an error when i use the stem() function to plot the graph, how can I fix this error?当我使用 stem() 函数绘制图形时,我不断收到错误,我该如何解决这个错误?
【发布时间】:2015-07-07 16:30:20
【问题描述】:
n=[0:20];   
x=[1 0 1];   
h=2*(3.^n).*(n>=0);   
y=conv(x,h);   
size=length(y);   
a=[0:size];   
p = stem(a, y, 'r', 'filled');  
set(p, 'LineWidth', 2, 'MarkerSize', 4);   
title('y[n]=x[n]*h[n]');   
xlabel('n');   
ylabel('y[n]');   

这是我运行程序后得到的错误:

Error in problem4a (line 8)
stem(n,y);

【问题讨论】:

    标签: matlab


    【解决方案1】:

    我发现了问题,我所要做的就是将第 6 行更改为以下内容: a=[0:(size-1)];

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-01-07
      • 2022-12-21
      • 2020-01-22
      • 2011-09-04
      • 2018-03-09
      • 2016-07-21
      • 2016-09-09
      相关资源
      最近更新 更多