The output signal OUT was observed on a scope and was also compared with the input on a dual channel scope.. The input signal looks like the one shown in figure below Figure 7a input of
Trang 1EXPERIMENT #7
DATA ACQUISITION
1/27/2010
Group:
Trang 2DATA ACQUISITION
PURPOSE
The objectives of this laboratory are:
1 To examine signal sampling, aliasing and signal reconstruction
2 To implement a time division multiplexing system
3 To investigate the quantization error associated with analog-to-digital conversion
EQUIPMENT LIST
1 PC with Matlab and Simulink
Trang 3LABORATORY PROCEDURE
I Sampling
A The time division Multiplexer (TDM MUX) module is used to recombine two analog signals into one data stream The input A is connected to the OUT connector for a period T (T = 1/fs) During the next period, input B is connected to the OUT
connector The process then repeats It should be obvious that each input, input A(or B) is “Sampled” at a rate equal to ½ fs as set by the Master clock
NOTE: The actual waveform sampling rate = ½ fs as set by the “DATA/Sampling RATE”, output, mentioned above (e.g to sample a 1kHz cosine, using this equipment
at the Nyquist rate then fs would have to be set to 4 kHz)
B Next the fs were set to 10kHz and the function generator frequency was set to 1kHz
The output signal OUT was observed on a scope and was also compared with the input on a dual channel scope The value of fs was slightly adjusted for a stable display The scope was moved to the sample-and-hold (S & H) output We see that the amplitude variations during the sampled period are now replaced with a constant
“flat top”
Figure 7a – Sampling using Sample and Hold
Trang 4The input signal looks like the one shown in figure below
Figure 7a input of the sampling using sample and hold method
Figure 7a Output of the Sample and hold circuit
t
The result when the input is overlapped with the output is what is shown below
Trang 5C Next the function generator was connected to both the inputs A and B at the OUT connector of the TDM MUX, the generator’s signal appears undistorted We see that after moving the scope tot he S & H connector the signal is now being sampled at fs (See figure 7B)
figure 7b(a) Time Division Multiplexing - Implementation
figure 7b (b)Time division Multiplexing – Input signal
Trang 6figure 7b(c): Time division Multiplexing, Output
D The output spectrum of the S & H output is observed Values of f and fs are varied and the effects of aliasing observed
E Effect of filtering: The sampled signal was reconstructed by feeding through a 4th order LPF to remove the aliasing frequencies
II Time Division Multiplexing
A Although multiplexing not classified as “data acquisition,” we shall make use of TDM modules at this time Two sine waves were prepared to be multiplexed by setting the two VCO’s in open loop to 1 kHz and 2 kHz Connect the 1 kHz sine
wave to the A input and 2 kHz since wave to the B input (see figure 7c) Set fs for
10kHz The output OUT and S & H outputs in time and frequency domain were observed Yes, we can say that sampling frequency for the TDM system is fs/2 (i.e half the time you sample A and half the time you sample B)
Figure 7c (a) Muxed signals
Trang 7B The S & H signal was connected to the TDM DEMUX Internal timing connects the TDM DEMUX input signal to the A output when the A input signal is selected by the MUX Similarly, the B output is connected to the DEMUX input when the MUX selects input B Thus, the TDM signal becomes “demultiplexed” The Dual LPF was used to reconstruct the S & H DEMUX output waveforms All the waveforms observed are attached
Figure 7c (a) Output of Signal 1 of TDM
Figure 7c(b) Implementation of 2 signal TDM
Trang 8Figure 7c(c) Output of the two signal TDM
III A/D conversion
A Now the conversion of analog to digital pulse is considered This conversion is part
of the pulse code modulation (PCM) system
B There is an inherent noise component in the system due to the quantization of the signal in the PCM encoding and decoding This noise is the error between the actual value of the analog input and the decoded analog signal from the PCM-ANALOG module If we were to subtract the resulting quantified signal from the original signal,
a noise voltage would result This could then be used to form a quantization signal-to-noise power ratio
Figure 7(III) a – The pulse code modulation with variable quantization
Trang 9Here is a plot of the input signal (Analog) to the PCM system
Figure 7(III)b Input signal
The quantized signal is given below
Figure 7(III)b Quantized signal
The input file is quantified using the PCM encode and de-quantified using the PCM decode block The block parameters are shown below
Trang 10Figure 7(III)b Quantizer parameters
Figure 7(III)d DE- Quantizer parameters
The output of the decoder is fed to a subractor block, which takes the difference of the input signal from the output and gives the signal noise generated The noise generated and the numeric value is also shown
Trang 11Figure 7(III)e Difference – Noise of the PCM
The output of the de-quantized block is further filtered
Figure 7(III)f Quantization recovered value
The output as compared to the input looks some what like below
Figure 7(III)g Input and Output compared
Trang 12C There is a delay of about 2T in the PCM system between the input and output signals This will result in an unwanted error due to phase shift Selecting the maximum sampling rate and a LOW signal frequency (Say 20Hz) can reduce this error This delay is an important point to be understood because it is inherent in al digital
communication systems
D Keeping this delay error in mind, the quantization SNR curve as a function of the number of quantization levels (27,26,25…21) which can be changed by the MSB/LSB switches on the ANALOG-PCM module Your input should be +- 2.5V triangle wave
at a low frequency You should also observe the output signal with a scope
E The effect of LPF on the signal reconstruction has been observed
clear all;
close all
x = [2 4 8 16 32 64 128];
y = [1.32 0.828 0.465 0.464 0.47 0.48 0.49];
plot(x,y,'r*');
grid on
zoom on
title('Plot of L v/s Noise RMS, input rms = 1.39V');
xlabel('Quantization levels L')
ylabel('Noise RMS');
0.4
0.5
0.6
0.7
0.8
0.9
1
1.1
1.2
1.3
1.4
Plot of L v/s Noise RMS, input rms = 1.39V
Quantization levels L
Trang 13L (Quantization Levels)
Noise RMS
We see that the Noise RMS decreases with increase in the quantization levels
Trang 14Prelab Questions
Experiment # 7
Trang 151 At 1kHz cosine wave is sampled by a series of impulses spaced T seconds apart
where T=1/fs (sampling frequency) If fs = 5,000 Hz find the positive frequency spectrum of the sampled signal (amplitude only)
The spectrum of s(nT) is the spectrum of cos(2π*1000*t) convoluted with the spectrum of the impulse train
The spectrum of cos(2π*1000*t) is
∑∞
−∞
=
−
×
⋅
⋅
=
n
nT t t
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Frequenc y (Hz )
M agnitude s pec trum of c os (2*pi*1000*t) - pos itive freq s ide only
Trang 16The spectrum of the impulse train is
The convolution result of the two above spectra is
The magnitude spectrum above is also the magnitude spectrum of s(nT)
x 104 0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Frequenc y (Hz )
M agnitude s pec trum of the im puls e train - pos itive freq s ide only
x 104 0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Frequenc y (Hz )
M agnitude s pec trum of s (nT) - pos itive freq s ide only
Trang 17An nth order low pass filter is used to reconstruct the sampled signal in question #1 and has an amplitude response of:
where n = the order of the filter and f3 = 3dB cutoff =1 kHz
If a 4th order filter is used, what would be the lowest sampling frequency that would cause less than 1% distortion due to aliasing?
(Hint: Assume that the single aliasing impulse that is closest to the 1 kHz signal contributes the most to the aliasing error.)
If it is assume that the single aliasing impulse that is closest to the 1 kHz signal contributes the most to the aliasing error, then this problem is equivalent to find the frequency such that the |H(f)|
is 1% of the value at 1 kHz And from this frequency, the lowest sampling frequency that would cause less than 1% distortion due to aliasing is compute by adding 1000Hz to it
So, first we have to find the frequency such that the |H(f)| is 1% of the value at 1 kHz
|H(1000)| = 2 -0.5 = 0.7071
Want to find f such that |H(f)| = 0.7071*0.01 = 0.007071
Therefore, the lowest sampling frequency must be 3448.5 + 1000 = 4448.5 Hz
2 If an 8th order filter is used, what would be the lowest sampling frequency that would cause less than 1% distortion?
Do the same for problem #2 but this time change n to 8, then the equation that need to be solved
is
n
f f
3
1
1 )
H(
⎟
⎠
⎞
⎜
⎝
⎛ +
=
Hz 5 3448
get and for equation above
the
solve
1000 1
1 007071
.
=
⎟
⎠
⎞
⎜
⎝
⎛ +
=
∴
f
f f
Hz 0 1857
get and for equation above
the
solve
1000 1
1 007071
.
=
⎟
⎠
⎞
⎜
⎝
⎛ +
=
∴
f
f f
Trang 18Therefore, the lowest sampling frequency must be 1857.0 + 1000 = 2857.0 Hz
3 A 4-bit A-D converter has a sampling rate of 16 kHz This system samples a 1 kHz triangle wave that has an amplitude that exactly spans the converter’s quantization range Sketch the unfiltered D-A output, if this signal is the A-D input
Create one period of triangle signal in MATLAB with command:
t=[0:(16*10^3)^-1:10^-3];
s=[t(1:9) t(8:-1:1)]/.5e-3*2-1;
The use the following Simulink model to get the quantized signal
The quantizer was configured with these parameters,
Quantization partition: p=[-1+.125:.125:.875]
Quantization codebook: c=[p-.125/2 875+.125/2]
The output waveform compared to the original waveform is
si m o u t
T o Wo rksp a ce
S ca l a r
q u a n ti ze r
S a m p l e d
q u a n ti ze r e n co d e
[t;s]'
Fro m
Wo rksp a ce
x 10-3 -1
-0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Tim e (s )
Original s ignal and quantiz ed s ignal