Convert signal from time domain to frequency domain with fft
58 ビュー (過去 30 日間)
古いコメントを表示
Hello to everyone
I have signal and time arrays. for example;
signal1 = 1x609
signal1 = [0.0068, 0.0166, ..., 0.5054]
T = 1x609
T = [48.4044, 48.6210, ..., 179.1312]
I wrote a code like this to convert this signal to frequency medium, but I don't know how to determine its frequency. I would be very happy if you could help me with this subject.
X=fftshift(fft(signal1));
fs=10;
df=fs/N; % the frequency increment
f=-fs/2:df:fs/2-df;
figure;
plot(f,abs(X));
0 件のコメント
採用された回答
Star Strider
2021 年 5 月 4 日
If ‘T’ (that I assume is the time vector) is regularly-sampled (constant sampling intervals), first determine the sampling intervals, then use them to calculate the frequency vector:
L = numel(T); % Length Of Time & Signal Vectors
Ts = mean(diff(T)); % Sampling Interval
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Fv2 = linspace((-Fn, Fn, L); % Frequency Vector For Two-Sided Fourier Transform
The fftshift call leads me to believe that the goal is to plot the two-sided Fourier transform.
If the signal is not regularly-sampled, it must be converted to regular sampling to do any reliable signal processing on it. Use the resample function for that purpose first, then calculate the fft and any other signal processing on the resampled signal.
4 件のコメント
Star Strider
2021 年 5 月 4 日
As always, my pleasure!
Normalise it in the fft call —
X = fftshift(fft(signal1)/L);
Note — The ‘L’ calculation and assignment needs to go before the ‘X’ calculation and assignment.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Multirate Signal Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!