convert time to frequency domain

11 Ansichten (letzte 30 Tage)
Ambika Soram
Ambika Soram am 10 Sep. 2019
Kommentiert: Star Strider am 20 Apr. 2021
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.

Akzeptierte Antwort

Star Strider
Star Strider am 10 Sep. 2019
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 Kommentare
Asrith Pyla
Asrith Pyla am 20 Apr. 2021
@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 am 20 Apr. 2021
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by