필터 지우기
필터 지우기

Convert signal from time domain to frequency domain with fft

조회 수: 35 (최근 30일)
Zaref Li
Zaref Li 2021년 5월 3일
댓글: Star Strider 2021년 5월 4일
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));

채택된 답변

Star Strider
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
Zaref Li
Zaref Li 2021년 5월 4일
Thank you for your help. It was said that normalization to the signal should also be common. I was told that I need to divide by the fft size, L. Where do I write this / L statement?
Star Strider
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 CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by