Interactive Demo of Nyquist's Sampling Theorem
This script demonstrates Nyquist's Sampling Theorem, by sampling a continuous-time sinusoidal signal of a frequency f = 50 Hz to 3 kHz, with a fixed sampling frequency fs = 2 kHz. Therefore, only signals with frequencies f <= fs/2 = 1 kHz can be faithfully reconstructed by their samples, while those with frequencies f > 1 kHz will exhibit aliasing effects (i.e., reconstructing the original signal will generate new components that were not part of the original signal).
The generated graph shows both the original signal (in red) and the reconstructed signal (in blue). The reconstructed signal is linearly interpolated and shown together with the samples (circle markers). The user can interactively change the original signal's frequency and phase, and observe how this affects the reconstructed signal, as the frequency approaches and crosses the fs/2 boundary.
In order to have a better appreciation of the aliasing effects on the signal being sampled, the user can listen to both the original and the reconstructed signals and compare the corresponding sounds. This is only possible on sound-capable computers.
The simulation can be interactively controlled in real-time using the following keys:
[Q] / [A] increases/decreases the original signal's frequency (coarse).
[W] / [S] increases/decreases the original signal's frequency (fine).
[E] / [D] increases/decreases the original signal's phase.
[I] plays a one-second sound of the original signal.
[O] plays a one-second sound of the reconstructed signal.
[R] resets all parameters to their initial values.
[ESC] exits the script.
引用格式
Costas Vlachos (2024). Interactive Demo of Nyquist's Sampling Theorem (https://www.mathworks.com/matlabcentral/fileexchange/61143-interactive-demo-of-nyquist-s-sampling-theorem), MATLAB Central File Exchange. 检索来源 .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
- Signal Processing > Signal Processing Toolbox > Transforms, Correlation, and Modeling > Transforms > Discrete Fourier and Cosine Transforms >
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.50.0.0 | Improved description layout.
Improved description layout.
|