In this project I made a simple simulation of how an analog signal becomes digital. The process has four main steps:
1 ANALOG SIGNAL
I start with a sine wave of 100 Hz.
I use a very small time step, so the signal looks continuous.
This is my reference “analog” signal.
Result: a smooth curve, the original wave.
2 SAMPLING
The analog signal is sampled with different frequencies (Fs = 150, 200, 500, 1000 Hz).
150 Hz (below Nyquist) → the samples are not enough, the signal looks distorted.
200 Hz (at Nyquist) → the minimum frequency to capture the signal, but still not very clear.
500 and 1000 Hz (above Nyquist) → the signal is represented much better.
This shows the Nyquist theorem: the sampling frequency must be at least 2 times the signal frequency.
3 QUANTIZATION
After sampling, the amplitude of each point is mapped to a fixed number of levels.
I tested 8, 16, and 64 levels.
8 levels (3 bits) → very rough signal, steps are big.
16 levels (4 bits) → better, but still visible distortion.
64 levels (6 bits) → the signal looks smooth, very close to the original.
More levels = higher accuracy, but also more bits are needed.
4 SUMMARY
The simulation shows the complete path:
Analog → Sampling → Quantization → Digital Representation
If sampling is too low → aliasing and distortion.
If quantization levels are too low → the signal loses quality.
Higher sampling and more levels → better quality, but more data to store or transmit.
Here is the link to the code on GitHub: https://github.com/IraitzMaritxalar/analog-to-digital-simulation
Top comments (0)