フィルターのクリア

Time stamp for discrete Fourier transform

6 ビュー (過去 30 日間)
desert_scientist90
desert_scientist90 2019 年 12 月 19 日
コメント済み: Star Strider 2019 年 12 月 19 日
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);

採用された回答

Star Strider
Star Strider 2019 年 12 月 19 日
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 件のコメント
desert_scientist90
desert_scientist90 2019 年 12 月 19 日
Thanks! I was kinda lost with this but now I understand!
Star Strider
Star Strider 2019 年 12 月 19 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by