Sie sind auf Seite 1von 5

Sampling, Quantization and Reconstruction

This lab covers several examples to further convey sampling, quantization, and reconstruction aspects of analog-to-digital and digital-to-analog signal conversion processes.

Lab. practice Aliasing


In this example, a discrete signal is generated by sampling a sinusoidal signal. When the
normalized frequency f / fs of the discrete signal becomes greater than 0.5, or the Nyquist
frequency (f = frecuency of the signal and fs = Sampling frecuency), the aliasing effect
becomes evident. A sampling process is done by setting the sampling frequency fs to 1 kHz,
and the number of samples N to 10. This results in a 10 ms sampled signal. The signal
frequency is arranged to vary between 0 to 1000 Hz using a FP control. Figure 1 shows a
sinusoidal signal having a frequency of 300 Hz which is sampled at 1 kHz for 10 ms
producing 10 samples, which are displayed in a Waveform Graph.

Figure 1

In this graph, an analog signal representation is also made by oversampling the sinusoidal
signal 100 times faster. In other words, an analog signal representation is obtained by
considering a sampling frequency of 100 kHz generating 1000 samples. The FP of the VI
includes a Horizontal Slide control for the signal frequency, and two Numeric Indicators for
the normalized frequency and aliased frequency. A Stop Button associated with a While
Loop on the Block Diagram is located on the FP. Make a front panel like the figure2.

Figure 2
This button is used to stop the execution of the VI.Figure 3-13 shows the BD for this
sampling system. To generate the analog and discrete sinusoids, three Sine Wave VIs
(Functions All Functions Analyze Signal Processing Signal Generation
Sine Wave) are used. These VIs are arranged vertically in the middle of the BD. The inputs
to these VIs consist of the number of samples, amplitude, frequency, and phase offset.
Amplitude is set to 1 by default in the absence of any wiring to the amplitude terminal. The
f terminal requires frequency to be specified in cycles per sample, which is the reciprocal of
number of samples per period. For phase, the numeric constant 90 is wired to the phase in
terminal.

Figure 3
The output of the VI consists of an array of its sinewave samples. The Build Waveform
function (Functions All Functions Waveform Build Waveform) is used to build
a waveform by combining the samples into the Y terminal, and the time duration between
samples, Ts = 1/1000, into the dt terminal. As discussed earlier, the number of samples for
the analog representation of the signal is set to 100 times that of the discrete signal. Thus, to
keep the ratio of frequency to samples the same as that of the discrete signal, the value
wired to the f terminal is divided by 100. Also, the time interval of the analog signal is set
to one hundredth of that of the discrete signal.Among the three Sine Wave VIs shown in
Figure 3, the top VI generates the discrete signal, the middle VI generates the analog signal,
and the bottom VI generates the aliased signal when the signal frequency is higher than the
Nyquist frequency.A Case Structure is used to handle the sampling cases with aliasing and
without aliasing. If the normalized frequency is greater than 0.5, corresponding to the True
case, the third Sine Wave VI generates an aliased signal. All the inputs except for the
aliased signal frequency are the same.Note that an Expression Node (Functions All

Functions Numeric Expression Node) is used to obtained the aliased frequency. An


Expression Node is usually used to calculate an expression of a single variable. Many builtin functions, such as abs (absolute), can be used in an Expression Node to evaluate an

equation. For the False case, that is, sampling without aliasing, there is no need to generate
an aliased signal. Thus, the analog signal is connected to the output of the case structure so
that the same signal is drawn on the waveform graph and the frequency of the aliased signal
is set to 0. This is illustrated in Figure 3-14. It should be remem-bered that, when using a
Case Structure, it is necessary to wire all the outputs for each case.
An aliasing outcome is illustrated in Figure 3-15, where samples of a 700 Hz sinusoid are
shown. Note that these samples could have also been obtained from a 300 Hz sinusoid,
shown by the dotted line in Figure 3-15.

All the three waveforms are bundled together by using the Build Array function and
displayed in the same graph. The properties of the Waveform Graph should be configured
as shown in Figure 3-15. This is done by expanding the plot legend vertically to display the

three entries and renaming the labels appropriately. Right-click on the Waveform Graph and
choose Properties from the shortcut menu. A Waveform Graph Properties dialog box will be
brought up. Select the Plots tab to modify the plot style. Choose Sampled Signal in the Plot
drop down menu, see Figure 3-16. Also, choose the options for Point Style, Plot
Interpolation, and Fill to as indicated in this figure. Adjust the line style of the aliased signal
to dotted line.Rename all the controls and indicators, and modify the maximum scale of the
Horizontal Pointer Slide control to 1000 to complete the VI.

Das könnte Ihnen auch gefallen