convert time to frequency domain

19 ビュー (過去 30 日間)
Ambika Soram
Ambika Soram 2019 年 9 月 10 日
コメント済み: Star Strider 2021 年 4 月 20 日
I have a time domain signal and want to convert to frequency domain using FFT. I would be very grateful if someone could help me plot frequency vs normalised FFT amplitude. I have attached my time domain file and a photo of how i would like my plot to be. Any help would be much appreciated.

採用された回答

Star Strider
Star Strider 2019 年 9 月 10 日
To normalise it to a maximum value of 1, divide the Fourier transformed data by the maximum of the Fourier transformed data:
D = load('time_domain.txt');
t = D(:,1);
s = D(:,2);
L = numel(t); % Vector Length
Ts = mean(diff(t)); % Sampling Interval
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
FTs = fft(s)/L; % Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
FTs_plot = abs(FTs(Iv))/max(abs(FTs(Iv))); % Normalised Fourier Transform
figure
plot(Fv, FTs_plot)
grid
xlim([0 0.5])
  6 件のコメント
Asrith Pyla
Asrith Pyla 2021 年 4 月 20 日
@Star Strider I have a time series signal which has to be obtained in the frequency domain. In the above case, I see that for obtaining the x axes limits between 0 and 500 you have rescaled the sampling interval. Why should one has to rescale the sampling interval for changing the x axes bounds from [0, 0.5] to [0, 500]? I require my output between 1khz and 350khz [1000, 350000]. What should my sampling interval be?
Star Strider
Star Strider 2021 年 4 月 20 日
I used the xlim call to ‘zoom’ the plot to show detail.
The sampling interval is created by the instrumentation, although you can use the resample functtion to change it or to regularize a signal with inconsistent sampling intervals so it can be used with other signal processing techniques, such as discrete filters. The sampling frequency is the inverse of the samplilng interval, and the highest frequency that that can be uniquely represented is the Nyquist frequency that is one-half of the sampling frequency.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by