convert time to frequency domain
23 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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
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
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 Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!