Shannon-Nyquist Sampling Theorem: Perfect Reconstruction Formula Verification
In class, we derived the perfect reconstruction formula in the Shannon/Nyquist sampling theorem as
xa(t) = 2T * fc * Σ[n=-∞ to ∞] xa(nT) * sinc(2fc(t - nT)) (1)
where xa(t) is a given analog signal, T is the sampling period, and fc is the cut-off frequency of the ideal low-pass filter used in the reconstruction. In (1), the right-hand-side (RHS) involves parameters T and fc while the LHS does not.
(a) Carry out computer experiments to check if (1) holds for some examples. (b) Prove the conclusion you obtained from your computer experiments
To check if equation (1) holds for some examples, we can perform computer experiments using Python. We will generate a sampled signal and then reconstruct it using the formula, comparing the reconstructed signal with the original analog signal. Here's an example implementation:
import numpy as np
import matplotlib.pyplot as plt
# Define the original analog signal
def xa(t):
return np.sin(2 * np.pi * 10 * t) + np.cos(2 * np.pi * 20 * t)
# Define the sampling period and the cut-off frequency
T = 0.01
fc = 25
# Generate the time axis
t = np.linspace(0, 1, 1000)
# Sample the analog signal
x_sampled = xa(t[::int(1/T)])
# Reconstruct the signal using the formula
reconstructed_signal = np.zeros_like(t)
for n in range(len(x_sampled)):
reconstructed_signal += x_sampled[n] * np.sinc(2 * fc * (t - n * T) / T)
# Plot the original signal, sampled signal, and reconstructed signal
plt.plot(t, xa(t), label='Original Signal')
plt.stem(t[::int(1/T)], x_sampled, label='Sampled Signal')
plt.plot(t, reconstructed_signal, '--', label='Reconstructed Signal')
plt.legend()
plt.xlabel('Time')
plt.ylabel('Amplitude')
plt.title('Signal Reconstruction')
plt.show()
In the above code, we define the original analog signal xa(t) as a combination of sine and cosine functions. We then sample the analog signal using the given sampling period T. Next, we use a loop to reconstruct the signal using the formula from equation (1), accumulating contributions from each sampled point. Finally, we plot the original signal, sampled signal, and reconstructed signal for comparison.
By running this code with different values for the analog signal and parameters T and fc, you can observe the reconstructed signal and compare it with the original signal. If the reconstructed signal closely matches the original signal, it indicates that equation (1) holds for the given example.
Please note that due to the finite number of samples and the discrete nature of computation, the reconstructed signal may not be an exact match for the original analog signal. However, it should be a good approximation if the sampling theorem conditions are satisfied.
Based on your computer experiments, you can observe the agreement between the reconstructed signal and the original signal, which provides evidence for the validity of equation (1) in those specific examples.
原文地址: https://www.cveoy.top/t/topic/cGgN 著作权归作者所有。请勿转载和采集!