フィルターのクリア

FFT of discrete time domain data

2 ビュー (過去 30 日間)
shravankumar
shravankumar 2011 年 4 月 19 日
コメント済み: Imantha Ahangama 2018 年 10 月 21 日
Dear all,
I have vibration data from a setup in time domain. I need to convert into frequency domain,for which i have coded as below
n=length(data);
ts=t(2)-t(1);
p=abs(fft(data));
p=p(1:n/2).^2;
freq=[1:n/2]/ts;
figure(2)
plot(freq,p)
But the frequency components obtained in the plot, are not matching with actual ones,which i think the error in frequency axis of fft plot.Is any normalisation of axis needed . how to rectify this error .
Regards.

採用された回答

Arnaud Miege
Arnaud Miege 2011 年 4 月 19 日
I would suggest following the example in the fft documentation:
n = length(data);
Ts = t(2)-t(1); % sample time
Fs = 1/Ts; % sampling frequency
NFFT = 2^nextpow2(n); % Next power of 2 from length of data
Y = fft(data,NFFT)/n;
f = Fs/2*linspace(0,1,NFFT/2+1);
% Plot single-sided amplitude spectrum.
plot(f,2*abs(Y(1:NFFT/2+1)))
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
HTH,
Arnaud
  3 件のコメント
Ella
Ella 2015 年 12 月 1 日
Hi Shravankumar do you get the same amplitude of vibration as your time domain ? I tried using the same code to get FFT of my signal but the amplitude drops. How can I solve this ? your suggestion is appreciated
Imantha Ahangama
Imantha Ahangama 2018 年 10 月 21 日
@Ella, Try
data = data - mean(data);
before typing the above code.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by