Borrar filtros
Borrar filtros

Vectors must be the same length

1 visualización (últimos 30 días)
Mya
Mya el 27 de Nov. de 2021
Comentada: Star Strider el 27 de Nov. de 2021
N1=64;
Y1=fft(y,N1);
x= (0:29);
subplot(3,1,2)
plot(x,abs(Y1))
xlabel('Frequency (Hz)');
ylabel('Amplitude');
%HOW TO MAKE IT SAME LENGTH?(LINE5)

Respuesta aceptada

Star Strider
Star Strider el 27 de Nov. de 2021
The number of elements in ‘Y1’ in the plot need to be the same as the number in ‘x’ so one way would be to re-define ‘x’ to be the desired length with respect to ‘Y1’ and another would be:
plot(x,abs(Y1(1:numel(x))))
Use the approach that gives the desired result.
.
  5 comentarios
Mya
Mya el 27 de Nov. de 2021
ok tq for ur guide
Star Strider
Star Strider el 27 de Nov. de 2021
As always, my pleasure!
.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by