Tidal prediction

17 ビュー (過去 30 日間)
Dany
Dany 2012 年 5 月 23 日
コメント済み: Alexandria 2016 年 6 月 29 日
Hello, im trying to perform tidal prediction. in order to do that i need to analyse the raw data from the mareograph and to get the amplitude and the phase of the first 20 frequencies (those ones have the most impact in the data).
i've used the following functions: Y=fft(X); %X is the raw data Ph=angle(Y); Amp=abs(Y);
the problem is that the values that im getting for the amplitudes are enormous (the original data has values up to 0.4 meters, the amplitude has valuse of tens sometimes hundreds of meters) wich is wrong.
how can i fix it? what am i doing wrong?
thanx for the help .....
  1 件のコメント
Alexandria
Alexandria 2016 年 6 月 29 日
I want to perfom a tidal prediction, what data do you need to use?

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

採用された回答

Wayne King
Wayne King 2012 年 5 月 23 日
Hi Dany, you are most likely not scaling the estimates by the length of the input vector. For example.
t = 0:0.001:1-0.001;
x = cos(2*pi*100*t-pi/4)+0.5*randn(size(t));
xdft = fft(x);
xdft = xdft(1:length(x)/2+1);
xdft(2:end-1) = 2*xdft(2:end-1);
xdft = xdft./length(x);
fprintf('Amplitude at 100 Hz is %3.2f.\n',abs(xdft(101)))
fprintf('Phase at 100 Hz is %2.3f radians.\n',angle(xdft(101)))
  3 件のコメント
Wayne King
Wayne King 2012 年 5 月 23 日
right, to make DFT as matlab implements it as a unitary operator, you have to multiply the output by 1/sqrt(length(x)). For the L2 norm:
x = randn(8,1);
norm(x,2)
xdft = 1/sqrt(length(x))*fft(x);
norm(xdft,2)
but 2/length(x) here for the positive frequencies gives you the MLE estimates of the sine wave amplitudes
Dany
Dany 2012 年 5 月 23 日
Wayne,
thank you for your help, it seems ok now.

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

その他の回答 (1 件)

Daniel Shub
Daniel Shub 2012 年 5 月 23 日
The concept of the first 20 frequencies doesn't make sense. The frequencies to which the first 20 components correspond depends on your sample rate and the number of samples in your signal/FFT. You might want to calculate the PSD instead of the FFT. Also, if all you want is the power in the low frequencies you might want to just lowpass filter your signal. Finally you might want to consider FREQZ instead of FFT.
There is no reason that the FFT of a waveform with a maximum magnitude of 0.4 cannot have values much much larger than 0.4. Consider
Amp = abs(fft(0.4*rand(1e5, 1)));
  1 件のコメント
Dany
Dany 2012 年 5 月 23 日
i will, thank you

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

カテゴリ

Help Center および File ExchangeDiscrete Fourier and Cosine Transforms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by