Hi, I have an assignment in wich i need to apply FFT in matlab. The problem is that i don't have any function or frequency because all of my data came out from an accelerometer. although i have sampling rate, sampling time interval and number of samples i don't know the frequency or the function of the sine wave formed by my data. Can you please enlighten me how to do my FFT? any help would be greatly appreciated

 Respuesta aceptada

Star Strider
Star Strider el 8 de Abr. de 2016

1 voto

See the documentation for the R2015a version of fft. The code between the top two plot figures is what you need to do.

4 comentarios

Vasilis Papadopoulos
Vasilis Papadopoulos el 9 de Abr. de 2016
Editada: Star Strider el 9 de Abr. de 2016
if you mean this code:
Y = fft(y,251);
Pyy = Y.*conj(Y)/251;
f = 1000/251*(0:127);
plot(f,Pyy(1:128))
title('Power spectral density')
xlabel('Frequency (Hz)')
can you please explain to me what is 251 represends cause I don't understand this example
Star Strider
Star Strider el 9 de Abr. de 2016
The ‘251’ is the number of points of ‘y’ used to calculate the fft. If the length of ‘y’ is shorter than that, then it is zero-padded to that lenght, if longer, it is truncated to a length of ‘251’. That refers to the length of a vector or the row-size of a matrix.
The rest of the code squares the elements of ‘Y’, creating the power spectral density. Only the first 128 samples are plotted because this is a one-sided fft (although I would have chosen 126 instead of 128, since that is half the length of ‘Y’+1).
Vasilis Papadopoulos
Vasilis Papadopoulos el 10 de Abr. de 2016
thank you Sir
Star Strider
Star Strider el 10 de Abr. de 2016
My pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Fourier Analysis and Filtering en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 8 de Abr. de 2016

Comentada:

el 10 de Abr. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by