Time stamp for discrete Fourier transform

11 visualizaciones (últimos 30 días)
desert_scientist90
desert_scientist90 el 19 de Dic. de 2019
Comentada: Star Strider el 19 de Dic. de 2019
Hi all,
I am trying to create a time stamp for my weather data. I took my readings every three hours for simplicity sake lets say I just want four days and a half of August how can I do this? Attach is my attempt with my previous try.
Thanks in advance
a=[ 27 26 24 29 35 38 37 35 31 28 27 31 36 39 39 35 35 32 28 26 30 37 40 39 36 33 ]
a1=mean(a)%mean of matrix A
a2=a-a1;%subtraction of the mean at each observation
t1=datetime(2015,8,2);%time stamp attemp 1
t2=datetime(2015,8,6);
t1:hours(3):t2
y=fft(a2);

Respuesta aceptada

Star Strider
Star Strider el 19 de Dic. de 2019
Try this:
a=[ 27 26 24 29 35 38 37 35 31 28 27 31 36 39 39 35 35 32 28 26 30 37 40 39 36 33 ]
a1=mean(a)%mean of matrix A
a2=a-a1;%subtraction of the mean at each observation
t1=datetime(2015,8,2);%time stamp attemp 1
t2=datetime(2015,8,6);
tv = t1:hours(3):t2;
L = numel(a); % Nr Samples
Ts = 3/24; % Sampling Interval (Units: Days)
Fs = 1/Ts; % Sampling Frequency (Units: Cycles/Day)
Fn = Fs/2; % Nyquist Frequency (Units: Cycles/Day)
y=fft(a2)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
figure
plot(Fv, abs(y(Iv))*2)
grid
xlabel('Frequency (Cycles/Day)')
ylabel('Amplitude')
Experiment to get different results.
  2 comentarios
desert_scientist90
desert_scientist90 el 19 de Dic. de 2019
Thanks! I was kinda lost with this but now I understand!
Star Strider
Star Strider el 19 de Dic. de 2019
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by