Sampling and reconstruction under the Nyquist sampling theorem
First, let ’s take a look at the content of the Nyquist sampling theorem
Nyquist sampling theorem reveals the signal between the sampled signal and the original signal frequency, which requires the sampling frequency Must be greater than or equal to twice the highest frequency component of the original signal , the expression is
For this, we can understand it from another angle. If a signal is to be sampled, the requirement to be satisfied is that the sampling frequency is greater than or equal to twice the highest frequency component of the sampled signal (the best requirement is greater than twice, and when it is equal to twice, some special situations may occur) , That is, the sampling period needs to be less than or equal to half of the minimum period of all components of the sampled signal .
For example, if a continuous sinusoidal signal is composed of three sinusoidal signals with frequencies of 10Hz, 40Hz, and 80Hz, then if we want to sample the signal and make the sampled signal points represent the original signal waveform, we It is necessary to ensure that the sampling frequency is greater than or equal to 160 Hz, so as to ensure that the sampled signal points can be reconstructed back to the original signal waveform.
Take a MATLAB example.
The sampling frequency in the routine used here is fm, 2fm, 3fm (5Hz, 10Hz, 15Hz) to try to sample the signal, the code is as follows:
dt = 0.1; f0 = 1; T0 = 1/f0;
fm = 5*f0; Tm = 1/fm;
t = -2:dt:2;
f = sin(2*pi*f0*t)+1/3*sin(6*pi*f0*t);%连续信号
subplot(4,1,1),plot(t,f);
axis([min(t) max(t) 1.1*min(f) 1.1*max(f)]);
title('original signal and sample signal');
for i = 1:3
fs = i*fm; Ts=1/fs; %确定采样频率和周期
n = -2:Ts:2;
f = sin(2*pi*f0*n)+1/3*sin(6*pi*f0*n);
subplot(4,1,i+1),stem(n,f,'filled');
axis([min(n) max(n) 1.1*min(f) 1.1*max(f)]);
end
The effect is as follows: It
can be seen that in addition to the first sampling signal, the sampling frequency is 2fm, and the sampling signal of 3fm all restores the nature of the original signal waveform relatively well.
Next, we set the sampling frequency to 1fh, 2fh, and 3fh with the highest frequency components. The results are as follows: At
this time, the sampling signals with sampling frequencies of fh and 2fh and it is difficult to see the characteristics of the original signal.