Error using stem X must be same length as Y.
47 次查看(过去 30 天)
显示 更早的评论
Im plotting a Discrete time signal at matlab and im getting this error "Error using stem
X must be same length as Y."
close all;
clear all;
clc;
clf;
AM = 19390128
Sum = mod(AM,9)
n1 = -2:1:4;
s1 = size(n1);
x1 = Sum*ones(s1);
n2 = 4:1:10;
x2 = 0;
n3 = 10:1:20;
s3 = size(n3);
i = n3 + n3;
x3 = sqrt(i);
n = [n1,n2,n3];
x = [x1,x2,x3];
stem(n,x,)
grid
Could you help me maybe and tell me what's wrong?
0 个评论
采纳的回答
cr
2022-11-21
The lengths of x and n are different, 19 and 25. Plotting requires them to be equal.
I think you want to do
x2 = zeros(size(n2));
rather than x2 = 0;
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!