Problem with FFT amplitude plot

3 vues (au cours des 30 derniers jours)
Moon Datta
Moon Datta le 8 Août 2020
Commenté : Antonio Ciociola le 14 Août 2020
I have a dataset of nearly 3 hour duration. There are 30 sec interval of data points. I want to find the amplitude spectrum of data after performing FFT. And x axis will be periods in minute. But after applying fft I am not getting desired results.
If you can help me in this regard I will be grateful...and also Thanks in advance
  2 commentaires
dpb
dpb le 8 Août 2020
See the example PSD calculation via FFT in the documenation for FFT
doc fft
There's nothing anybody can tell you about any specific problem you're having from the above general description -- no data, no code, no nothing...
Moon Datta
Moon Datta le 9 Août 2020
Thanks dpb for your reply. Here I have uploaded the data I have. I need to find the periodicity(periods in minute) of this data. 1st column is time in UT. 2nd column is my data.

Connectez-vous pour commenter.

Réponses (3)

Star Strider
Star Strider le 14 Août 2020
To see the frequency peaks, it is necessary first to remove the D-C offset by subtyracting the mean of the signal:
D1 = readmatrix('data.xlsx');
t = D1(:,1);
data = D1(:,2);
figure
plot(t, data)
grid
L = numel(t);
Ts = mean(diff(t));
Fs = 1/Ts;
Fn = Fs/2;
datam = data - mean(data);
FTdata = fft(datam)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
[pk,ix] = max(abs(FTdata(Iv)));
figure
plot(Fv, abs(FTdata(Iv)))
hold on
plot(Fv(ix), pk, '^r')
hold off
grid
text(Fv(ix), pk, sprintf('\\leftarrow Frequency = %7.3f\n Amplitude = %7.3f', Fv(ix), pk), 'HorizontalAlignment','left')
producing:
Now, the main peak is clearly visible. (Note that there is some variation in the sampling times, so it would be best to use the resample function to make them all equal and therefore impprove the precision of the result.)
.

Antonio Ciociola
Antonio Ciociola le 8 Août 2020
It's hard to understand the problem without data and code.
The error that you get seems related to the amplitude of the spectrum so it's possible that you have forgotten to normalize the spectrum dividing by the number of samples.
Xs = (1/length(x))*fft(x);

Moon Datta
Moon Datta le 9 Août 2020
Thanks Antonio Ciociola for your reply. Here I have uploaded the data I have. I need to find the periodicity(periods in minute) of this data. 1st column is time in UT. 2nd column is my data.
  5 commentaires
Moon Datta
Moon Datta le 14 Août 2020
Expecting this type of variations from the data.
Antonio Ciociola
Antonio Ciociola le 14 Août 2020
Look at the answer that Star Strider. He suggests to remove the DC offset to see the frequency peaks but it seems that you have another problem.
The image that you've showed seems to suggest that you have a signal without DC component and with some higher frequency components.
Looking at the photo that Star Strider posted you could get the same consideration made before:
"Look at the result that I get. Is it useful? In my opinion this plot it's "telling" that the signal has a quasi zero frequency...and it seems quite correct because looking at the signal it has very slow variation and poor periodicity."
And it's different from the result showed in the photo that you posted above.
So the question is...are you sure that the result in the photo it's obtained with the same data? Maybe you need to observe the signal for a long time to appreciate it's periodicity.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by