 # Analog, discrete, digital: deciphered

## Unlike the virtual world within a computer, the real world is "analog." Real-world variables can change at any time, not just at the end of a scan cycle or sampling interval. Variables measured by a computer are "discrete." They remain constant until the next sampling interval, even if real-world values change.

By Vance VanDoren November 1, 2004

Unlike the virtual world within a computer, the real world is ‘analog.’ Real-world variables can change at any time, not just at the end of a scan cycle or sampling interval.

Variables measured by a computer are ‘discrete.’ They remain constant until the next sampling interval, even if real-world values change.

Computer variables are also ‘digital’—represented by a finite string of digits or bits. ‘Digitalization’ limits the precision with which an analog variable from the real world can be stored digitally in a computer.

The graphic shows an extreme case of how a computer can misrepresent the values of a real-world variable through discretization and digitalization.

Graphing the discretized variable reflects the general shape of the original real-world variable, but without the smooth curves. Note also that the discretized variable lags behind its analog counterpart, since its value can only change after the analog variable has already changed. The digitalization graph shows how the computer’s accuracy is reduced even further because the variable is limited not only by the times when it can change, but the values it can assume.

Fortunately, faster sampling and higher precision storage in today’s computers can greatly reduce the effects of discretization and digitalization.

Though fast sampling is usually beneficial, it is not always necessary for a feedback controller to sample a process variable as fast as it can. Likewise, extremely high precision may not help the controller achieve the desired closed-loop performance.

Consider the example in the graphic again, but suppose now that the analog variable represents some pressure, temperature, or flow rate to be controlled. Typically, such real-world variables do not change abruptly. Inertia and friction tend to limit their fluctuations to smooth, continuous curves.

In mathematical terms, such variables are said to have limited bandwidth. That is, the variable looks more like a low-frequency sinusoid than a high-frequency sinusoid. In such cases, the famous Nyquist Theorem states that sampling the variable at rates above a certain cutoff is a waste of computing power. All information required to completely reconstruct the original signal from the sampled data is contained in the samples collected at the cutoff rate. Additional samples resulting from faster sampling won’t help the controller gain any more useful information from the sampled signal.

In this example, the analog variable appears very much like a sinusoid that completes two cycles of varying amplitude in about 8 seconds. Signal bandwidth is therefore somewhere around 0.25 cycles per second. The Nyquist Theorem would place the cutoff frequency at twice that value so that a sampling interval of 0.5 samples per second (or one sample every two seconds) would be adequate to glean all of the useful information contained in this signal. Therefore, the sampling rate shown in the discretization graph—one sample per second—should be fast enough.

The case for limiting the precision of the controller’s storage to modest levels is easier to make. Real-world process variables are usually corrupted to some extent by measurement noise that limits the accuracy of data even before being sampled and stored. Using high-precision storage registers for the purpose would be overkill.