Error using stem X must be same length as Y.
48 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ANGELOS-VASILEIOS MANTZOUKAS
el 21 de Nov. de 2022
Comentada: ANGELOS-VASILEIOS MANTZOUKAS
el 21 de Nov. de 2022
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 comentarios
Respuesta aceptada
cr
el 21 de Nov. de 2022
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;
Más respuestas (0)
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!