Hello everyone,
I am doing relates to Fourier Transform form signal (as attached) to find the frequency of the signal. But my result is not correct (just I think because the result is so weird), I don't know where am I wrong. Plz help me fix this code.
Thank for your time
t1=0:359;
t=t1';
x = load('tremor_analysis.txt');
plot(t,x)
y = fft(x);
m = abs(y);
p = angle(y);
f = (0:length(y)-1)*359/length(y);
subplot(2,1,1)
plot(f,m)
title('Frequency')
This is my result:

 Respuesta aceptada

Walter Roberson
Walter Roberson el 21 de Dic. de 2016

0 votos

Remember that the first entry of the output, y(1), will store mean(x)*length(x), which is sum(x). Whenever your data is not centered around 0 you need to expect a peak at y(1).
You can either subtract off the mean(x) before doing the fft() or you can zero out y(1) before plotting.

3 comentarios

viet le
viet le el 21 de Dic. de 2016
Editada: viet le el 21 de Dic. de 2016
Sorry, I am not clear. could you explain more detail?
Walter Roberson
Walter Roberson el 21 de Dic. de 2016
y = fft(x - mean(x));
Image Analyst
Image Analyst el 21 de Dic. de 2016
Not sure what you're unclear about. He showed you one way, by subtracting the mean like he originally said. Or alternatively zeroing out y(1) like this:
y(1) = 0;
plot(y, 'b-');

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 21 de Dic. de 2016

Comentada:

el 21 de Dic. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by