I. Introduction
Frequency domain analysis of continuous signals: Divide signals into periodic and non-periodic. Using FS and FT analysis, the spectrum of continuous signals is symmetrical about the vertical axis and is non-periodic.
But computers cannot process continuous signals, only digital signals.
Therefore, the spectral characteristics of digital signals are more important:
2. DFT (Discrete Fourier Transform)
The spectrum of the digital signal is a periodic signal, the period is 2π rad/s (digital angular frequency), and the N-point DFT is the N-point equal interval sampling of the DTFT (Fourier transform) of the digital signal on [0, 2π]. FFT simplifies the calculation and improves the speed on the basis of DFT.
Digital angular frequency = analog angular frequency * sampling period, when digital angular frequency W=2π, the corresponding analog angular frequency is fs (sampling frequency).
Therefore, when the analog angular frequency/analog frequency (f) is used as the independent variable, the frequency spectrum is actually N sampling points with fs as the highest frequency.
When the digital angular frequency W is used as the independent variable, the frequency spectrum is actually N sampling points with 2π as the highest frequency.
matlab ffft
Y = fft(X)
%length(X) point DFT
Y = fft(X,n)
%n point DFT
Digital signal spectrum analysis independent variable: digital angular frequency; W=(0:N-1)*2*pi/N (for 2π N equal division)
Dependent variable: 20*log( abs ( fft ( x ) ) )/log(2) (dB)
Like the spectrum of a continuous signal, the DFT of a digital signal is also symmetrical about N/2, that is, about W=π, f=fs/2. W: digital angular frequency, f: analog frequency.
3. Continuous/digital signal frequency domain analysis
3.1. Continuous signal:
3.1.1 Periodic Signals: Single/Bilateral Spectrum, Symmetry and Power Spectral Density
unilateral spectrum:
Bilateral Spectrum:
3.1. 2. Aperiodic signal: spectral density continuous symmetry and energy spectral density
3.2 Digital Signals: Spectrum DTFT Period
DFT (FFT): Sampling DTFT at equal intervals at digital angular frequency [0,2π]N points/analog frequency [0,fs]N equal interval sampling, about N/2, π (digital angular frequency), fs/2 (analog frequency) symmetric.
Four. Digital signal spectrum analysis:
y = fft(x);length(x)点FFT
Frequency: Take the analog frequency f = (0:N-1)*fs/N
Amplitude-frequency: 20*log(abs(fft(x)*2/N))/log(10), in dB; or abs(fft(x))*N/2 is also available
Plot(w(1:N/2),y(1:N/2)), due to symmetry, take half of the points to draw the picture.
function plot_fft(x,fs)
%x:待处理信号
%fs:采样率
%N:N点FFT
N = length(x);
y = fft(x);
y = abs(y);
f = (0:N-1)*fs/N;
figure,plot(f(1:N/2),y(1:N/2)*2/N),grid on,xlabel('f/Hz'),ylabel('|fft(x)|'),title('信号幅频特性'),grid on;
end
function plot_fft_angle(y,fs,N)
%y = fft(x);
%N:采样点数
%fs:采样率
f = (0:N-1)*fs/N;
ph = 2*angle(y(1:N/2));
plot(f(1:N/2),ph(1:N/2));
end