From Analog to Digital: Signal Simulation

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 referenc…


This content originally appeared on DEV Community and was authored by Iraitz

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


This content originally appeared on DEV Community and was authored by Iraitz


Print Share Comment Cite Upload Translate Updates
APA

Iraitz | Sciencx (2025-09-08T11:47:06+00:00) From Analog to Digital: Signal Simulation. Retrieved from https://www.scien.cx/2025/09/08/from-analog-to-digital-signal-simulation-2/

MLA
" » From Analog to Digital: Signal Simulation." Iraitz | Sciencx - Monday September 8, 2025, https://www.scien.cx/2025/09/08/from-analog-to-digital-signal-simulation-2/
HARVARD
Iraitz | Sciencx Monday September 8, 2025 » From Analog to Digital: Signal Simulation., viewed ,<https://www.scien.cx/2025/09/08/from-analog-to-digital-signal-simulation-2/>
VANCOUVER
Iraitz | Sciencx - » From Analog to Digital: Signal Simulation. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/08/from-analog-to-digital-signal-simulation-2/
CHICAGO
" » From Analog to Digital: Signal Simulation." Iraitz | Sciencx - Accessed . https://www.scien.cx/2025/09/08/from-analog-to-digital-signal-simulation-2/
IEEE
" » From Analog to Digital: Signal Simulation." Iraitz | Sciencx [Online]. Available: https://www.scien.cx/2025/09/08/from-analog-to-digital-signal-simulation-2/. [Accessed: ]
rf:citation
» From Analog to Digital: Signal Simulation | Iraitz | Sciencx | https://www.scien.cx/2025/09/08/from-analog-to-digital-signal-simulation-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.