Hi
I'm trying to apply fft() to the spectrum analysis of a financial time series with 2608 (10 years) data with daily frequency... Can anyone suggest me how can I calculate freq and Pyy vectors from fft()?
Regards Marco

 Respuesta aceptada

Wayne King
Wayne King el 29 de Jun. de 2012
Editada: Wayne King el 29 de Jun. de 2012

0 votos

Below is an example.
t = 0:2607;
% just an example
% put a sine wave with a period of 120 days and add noise
x = cos(2*pi/120*t)+randn(size(t));
xdft = fft(x);
% because the length is even take the first N/2+1 points
xdft = xdft(1:length(x)/2+1);
Pyy = 1/length(x)*abs(xdft).^2;
% create frequency vector
df = 1/2608;
% frequencies in cycles/day
freq = 0:df:1/2;
plot(freq,10*log10(Pyy));
xlabel('cycles/day'); ylabel('dB/cycle/day');
% find maximum value
[maxval,index] = max(abs(xdft));
% frequency corresponding to maximum value
freq(index)

3 comentarios

Marco
Marco el 29 de Jun. de 2012
Hi Wayne King, thanks a lot for your help
bye, Marco
Virgil Stokes
Virgil Stokes el 7 de Feb. de 2019
How can you be certain that aliasing has not occurred?
Bjorn Gustavsson
Bjorn Gustavsson el 7 de Feb. de 2019
...and why run an fft on financial data - that most certainly isn't even remotely stationary.

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.

Preguntada:

el 29 de Jun. de 2012

Comentada:

el 7 de Feb. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by