Introduction To DSPXilinx
Introduction To DSPXilinx
Introduction To DSPXilinx
Introduction to DSP
Return Return
consumer Multimedia
Processing Power
applications Teleconferencing
100
Digital Video
Digital Mobile Comms
Multimedia
10
Computing
Biomedical DSP
Digital Telephony CD-Audio
1
1970 1980 1990 2000 time (years)
Digital Subscriber Loops: The last couple of years of the 1990s saw the introduction of DSL (digital subscriber
loops) which bring data rates of millions (M) bits/sec to the home over conventional telephone lines. In summary
DSL is using DSP techniques to allow the high frequency portions of a copper wire twisted pair (MHz) to be
utilised. Prior to the requirements for fast data communications, most telephone lines were bandlimited between
300-3400Hz - sufficient for voice, but rather limiting for data communications - this is the reason that “voiceband”
modems have a clearly calculable limit based on the available teleco bandwidth of a few kHz. The introduction
of DSL equipment to telephone exchanges will bring a new lease of life to the copper wire infrastructure.
The application of mobile multimedia will allow consumers to communicate via teleconferencing (audio and
video), and transmit documents (email/fax) from a small hand held communicator. Very high levels of
processing power will be required for the audio/video coding/compression algorithms and for the DSP
communications strategies. Third generation mobile communications (3G) will allow data rates of up to 2Mbits/
sec to be available from hand held wireless devices (laptop/mobile communicator). To achieve these high rates
a “chip” rate of some 5Mbits/sec to and from the basetation will be used. In order to process this speed of data
transfer, a modulation scheme called CDMA (code division multiple access) will be used. DSP strategies for
pulse shaping, channel equalisation, echo control, speech compression and so on, will require very powerful
DSP devices capable of 1000’s millions of instructions per second will be required. 2002 is the roll-out year....
Top
DSP in 2000’s - Towards Software Radio 4.2
• The ideal DSP enabled Software Radio receiver directly convert to/from
RF frequencies (typically GHz, (G = 109).
• Initial implementations will work with IF (mixed down from GHz to a few
MHz) frequencies.
f s > 2f RF
RF Antenna @ GHz
Output
Anti- ADC
Alias
Video,
Audio,
f s > 2f RF DSP & Data
Input
DAC
Video,
Linear RF Amplifier Audio,
& Data
For current mobile 2nd generation technologies, a desirable software radio would be one that could operate in
the 800 to 900MHz spectrum and can adapt between AMPs, GSM, DAMPs, CT2 and so on by simply changed
the software on the DSP processor.
The next generation of UMTS, although being driven by cooperating worldwide standards is likely to be a major
beneficiary from the implementation of software radio strategies. Currently multiband radios are available
(particularly in the USA) that cover both GSM at 900MHz and DECT at 1300MHz, although this is essentially
accomplished by having separate hardware rather than as a programmable SR architecture.
For next generation CDMA with 5MHz bandwidth if the ADC used 4 times bandpass sampling, then more than
20Msamples per second are required, with an analogue front end capable of integrating at a frequency range
extending as high as 2GHz. At least 18 bits of resolution is likely to be required. Currently such devices are not
available. The DAC would require to produce more than 20Msamples/sec at up to 18 bits, and input to a linear
RF amplifier.
Some of the ideas for software radio include algorithms toolbox’s, where for example there is separate software
for each standard stored within a handset or mobile terminal. Alternatively there may be a toolbox of algorithms
(such as QPSK, equalisers etc) which can be called with appropriate parameters depending on the actual
standard (GSM, W-CDMA etc) being used.
There is also the concept of over-air download whereby a mobile terminal can download required software to
the generic hardware of the mobile terminal. This, however, is a concept that is still a long time away.
Top
Amplification and Conditioning 4.3
Voltage
60dB
time time
Amplifier x 1000
V out
V out = 1000V in therefore ----------- = 1000
V in
y1 ( t ) = f [ x1 ( t ) ]
then by superposition: y 1 ( t ) + y 2 ( t ) = f [ x 1 ( t ) + x 2 ( t ) ]
y2 ( t ) = f [ x2 ( t ) ]
One of the simplest ways to test the linearity of a system is to input a pure tone sine wave, and if, at all
frequencies, the output is only a pure tone at the signal input frequency (i.e. no harmonics are produced), then
the system is truely linear.
Amplification is often presented as a logarithmic measure of the power amplification ratio ( P out ⁄ P in ) given the
large linear dymanic range. Recall that P ∝ V 2 , then:
Therefore if an amplification A = 1000 , then the power amplification is 60 dB. Similary an attenuation of a factor
of 1000, (or a gain of 0.001) corresponds to -60dB of gain, or 60dB of attenuation! The placement of the -ve
sign needs some care given the antonymity of the words gain and attenuation.
Top
Amplifier Distortion 4.4
Voltage
60dB
time time
Amplifier x 1000
• The above amplifier is non-linear and actually outputs the input signal
plus a 3rd order harmonic:
V out = ( 1000 x V in ) + 10 x ( V in ) 3
2
V out = V in + 0.001V in
Try to solve this equation for V in as a function of V out . ....not easy, and in fact there is not a unique solution.
(Consider even the a simple squared equation:
Non-linearities can cause serious problems in DSP by losing or masking desirable signal components.
It is probably true to say that every amplifier is non-linear to some extent. However if the power levels of the
non-linear signal components are very low, then for pragmatic implementation purposes the amplifier can be
considered linear; (the definition of “very low” of course depends on your application). In the above example
where the non-linear second harmonic component has 1/5 of the voltage (1/25th of the power) of the
fundamental, this is very high and the amplifier is at best “very” non-linear. Systems may often be classed as
“weakly non-linear”, “moderately non-linear”, or “strong non-linear”.
• Most acquired signals are corrupted by some level of noise which can
cause information to be lost.
time
Voltage
Signal
time
Voltage
Microphone
Signal + Noise
time
Noise
We should try to be clear about the difference between noise and distortion. Noise is usually the name given to
an interfering signal, and which is usually in most cases additive noise. Using signal processing techniques we
can address the effects of this noise and perhaps try and attenuate the noise using linear filtering or other
techniques in order to improve the signal to noise ratio. Distortion on the other hand is caused by some non-
linear process occuring in the signal acquisition or processing chain, and usually there is nothing that can be
done to address distortion after it has occured.
Additive Noise: Consider an acoustic signal source s ( t ) received by a microphone which is corrupted by a
nearby acoustic noise source n ( t ) . The composite signal recorded at the receiver is denoted y ( t ) . The simplest
form of “additive noise” that could occur would be y ( t ) = s ( t ) + n ( t ) A slightly more complex version of additive
noise is y ( t ) = s ( t ) + An ( t ) where the noise is attenuated by a factor of A perhaps because of the acoustic
propogation path. Even more realistically the additive noise may take the form y ( t ) = s ( t ) + An ( t ) + Bn ( t – t 0 )
given that the noise may arrive at the receiver via a number of paths. And in its more general form, the received
signal will take the form:
∞
y ( t ) = s ( t ) + ∫ n ( t )h ( t – τ ) dt
0 where h ( t ) is the “impulse response” of the acoustic path from noise source to
receiver. Therefore although we may know exactly what the noise source is emitting, to “remove” this noise from
y ( t ) also requires that we have “information” about the acoustic transfer path.
Top
The Noise/Distortion Chain.... 4.6
Atmospheric
noise/ Multipath/
Doppler/ Other
users
Loud Digital to DSP Speech Reception/
Speaker Analogue Conv. Decompress Demodulation
Quantisation Distortion: Quantisation distortion or noise is introduced by the analogue to digital converter
(ADC). Ideally we use as many bits in the ADC converter as possible for quality, but as few bits as possible to
keep bandwidth requirements low. To attempt to improve quality for a given low number of bits we may use
psychoacoustic quantisation noise shaping, or dithering techniques.
Speech Coding/Compression Noise: To keep bandwidth requirements low we require to compress the
signal. By compressing the signal we aim to maintain the signal quality and intelligibility but will accept some
level of distortion or loss of fidelity.
Modulation: The modulation/demodulation process will introduce various levels of noise and distortion due to
the various stages of modulation and filtering that are required.
Atmospheric/Multipath Noise: When the electromagnetic mobile signal is transmitted general signal reflection
problems, interference from other users etc, will introduce a level of noise. Therefore it is desirable that the
digital coding scheme is as resistant to noise as possible.
Top
Signal to Noise Ratio 4.7
• Taking the logarithm of the linear signal power to noise power ratio
(SNR) and multiplying by 10 gives the measure of decibels or dBs.
V 2 signal V signal
SNR = 10 log ------------------ = 20 log ---------------
V 2 noise V noise
I
SPL = 10 log -------- dB
I
ref
where I is the sound intensity measured in Watts per square meter (W/m2) and Iref is the reference intensity of
10-12W/m2 which is (or perhaps was!) the approximate lower threshold of hearing for a tone at 1000Hz.
Alternatively (and more intuitively given the name sound “pressure” level) SPL can be expressed as a ratio of
a measured sound pressure relative to a reference pressure, P ref , of 2 × 10 – 5 N/m 2 = 20 µ Pa:
I P2 P
SPL = 10 log -------- = 10 log ---------- = 20 log ---------- dB
I P2 P ref
ref ref
Intensity is proportional to the squared pressure. i.e. I ∝ P 2 . A logarithmic measure is used for sound because
of the very large dynamic range of the human has a linear scale of more than 10 12 and because of the
logarithmic nature of hearing. Due to the nature of hearing, a 6dB increase in sound pressure level is not
necessarily perceived as twice as loud in fact far from it. For example the difference in intensity between 110dB
and 116dB seems much greater than the same difference between 40dB and 46dB. The threshold of pain is
about 120dB. (See entry for Sone.)
It is worth noting that standard atmospheric pressure is around 101300 N/m2 and the pressure exerted by a
very small insect’s legs is around 10 N/m2. Therefore the ear and other sound measuring devices are measuring
extremely small variations on pressure.
Top
Generic Analogue I/O Signal Processing 4.8
Amplifier Amplifier
TONE ... Blue Suede
Shoes....
BASS
VOLUME ... Blue Suede
Shoes....
C
R
-
–1 t
V out = --------- ∫ V in dt
+
Vin
RC 0
Integrator
R
C
-
+
dV in
Vin V out = – R C ------------
dt
Differentiator
R1 Rf
V1
R2
V2 -
R3 +
Rf Rf Rf
V3
V out = ------- V 1 + ------- V 1 + ------- V 1
R1 R2 R3
Summer
Top
A Generic Input/Output DSP System 4.9
INPUT OUTPUT
TRANSDUCER ACTUATOR
fs fs
Anti- Recon-
Alias DSP structio
ADC Processor DAC
Filter n Filter
Return More....
The anti-alias filter is important in order to ensure that aliasing distortion is not introduced to the DSP system.
The reconstruction filter is important to ensure that reconstruction high frequency noise is not present in the
output signal.
In a DSP system the analogue voltage is converted from a real world signal, to a voltage, to binary numerical
values. DSP systems use binary numbers, or base 2 and usually with 2’s complement (to allow +ve and -ve
number representation.) Base 2 is used because it is easy to design electronic devices that only have two digits
corresponding to two voltage levels. Binary adders, multipliers, memory elements and so on are widely
available and together form the core element of every computer’s ability to perform high speed arithmetic. Every
DSP microprocessor/ASIC uses binary arithmetic. 2’s complement arithmetic used by most DSP processors
which allows a very convenient way of representing negative numbers, and imposes no overhead on arithmetic
operations. In two’s complement the most significant bit is given a negative weighting, e.g. for the 16 bit number.
Channel
... Blue Suede
Shoes....
Scotland USA
For radio based analogue communications a modulator is required to convert from voltage to an
electromagnetic radio frequency (RF) signal.
An example of (one way) analogue communication is an FM radio station (modulation to around 100MHz) or
first generation mobile telephones which had 30kHz of bandwidth available for a speech channel.
Modulation Demodulation
Radio
Channel
... Blue Suede
Shoes....
fspeech
USA
ADC
fchannel
Switch
DSP - coding Re-
DAC
& modulation const
Digital Line Interface
Data In RF Modulation
Channel
fspeech Scotland
fchannel
DAC
Switch
DSP - decoding Anti-
ADC
& demodulation Alias
Digital RF Demodulation
Data Out Line Interface
The digital coding/modulation may compress or coded the data in some way, then translate into QPSK or other
QAM format. A final analogue signal is then produced by the DAC which is then suitable for sending directly
over a cable, or it can be modulated by a carrier frequency (RF (radio frequency) or centre of the baseband).
The sampling rate f channel is at least twice the channel bandwidth to satisfy the Nyquist sampling criteria.
At the receive side, the analogue signal is demodulated from RF, or otherwise, and then converted to digital by
the ADC prior to the final stage of decoding/demodulation.
Note that with the generic input/output DSP system we have the signal “domain” sequence: analogue-digital-
analogue:
fs Digital fs
whereas with the DSP communications system we have the signal “domain” sequence: digital-analogue-
digital:
fchannel fchannel
Note that the ADC does not necessarily have a linear (straight line) characteristic. In telecoms for example a
defined standard nonlinear quantizer characteristic is often used (A-law and µ-law). Speech signals, for
example, have a very wide dynamic range: Harsh “oh” and “b” type sounds have a large amplitude, whereas
softer sounds such as “sh” have small amplitudes. If a uniform quantization scheme were used then although
the loud sounds would be represented adequately the quieter sounds may fall below the threshold of the LSB
and therefore be quantized to zero and the information lost. Therefore non-linear quantizers are used such that
the quantization level at low input levels is much smaller than for higher level signals. A-law quantizers are often
implemented by using a nonlinear circuit followed by a uniform quantizer. Two schemes are widely in use: the
A-law in Europe, and the µ -law in the USA and Japan. Similarly for the DAC can have a non-linear
characteristic..
Binary Output
Voltage Input
Top
Digital to Analogue Converter (DAC) 4.13
Voltage Output fs
Binary
2 Input
1 8 bit
10000000
10100000
11000000
11001000
1 0
0
1 DAC
127
1 Voltage
32
64
96
1
-128
-96
-64
-32
Binary Output
00100000
01000000
01100000
01111111 0
Input
-1 1
-2
Generic DSP
ADCs (Quantizer):
Dual Slope ADC - Uses a capacitor connected to a reference voltage, and time taken for capacitor to charge is
counted by a digital counter.
DACs:
Multiplying DACs, accurately trimmed resistor is used to generate the output voltage via summing amplifier.
In this course we will specifically study different type of ADC or DAC. We will use them as functional
components.
Because of the DSP processing within sigma delta devices (oversampling and noise shaping), later in the
course we will look at sigma delta in more detail.
Top
Signal Conditioning 4.14
• For the above ADC with a maximum input and output of 2 volts we
would require that the input signal to the ADC has a similar range:
Volts Volts
0.001 2
0.0005 1
Vmax
ADC
time time
-Vmax
Digital Output
The DSP designer must ensure that for the particular application, clipping does not in general occur.
Top
Sampling 4.15
1-
ts = ---
fs
Note that the mid-riser does not have a zero output level, whereas the mid-tread does have a zero output level
but there are more levels above the zero level than there are below, this being a feature of two’s complement
arithmetic.
For an ADC with a very low number of bits, the differences between the mid-tread and mid-rise quantizer may
be noticeable, particularly in terms of the perceived quantisation noise. For example if a very small sine wave
of amplitude q/10 was input to the above mid-rise quantiser, then the output would always be zero, 000.
However inputting the same waveform to the midtread would produce a square wave of levels 000 and 111 at
the same frequency as the sine wave. Hence the mid-tread registers something of the input signal, but the mid-
rise has not!
Top
Sampling an Analogue Signal 4.16
• If the ADC has finite precision due to a limited no. of discrete levels
then there may be a “small” error associated with each sample.
Voltage fs Binary ts
Value
0.25 4
3
0.125 2
1
0 ADC 0
-1
-0.125 time -2 time
-3
-0.25 -4
• The quantisation step size is 0.0625 volts. If an 5 bit ADC is used, then
the max/min voltage input is approx 0.0625 x 16 = 1 volt.
Generic DSP
01111 (+15)
Binary Output
0.0625 volts
Vmin = -1 volts
10000 (-16)
Top
Reproducing an Analogue Signal 4.17
Binary ts fs Voltage
Value
4 0.25
3
2 0.125
1
0 0
-1 DAC
-2 time -0.125 time
-3
-4 -0.25
• Note that the output is a little “steppy” caused by the zero order hold
(step reconstruction);
....this artifact can however be removed with a reconstruction filter.
Generic DSP
Vmax = 1 volts
0.0625 volts
Voltage Out
10000 (-16)
01111 (+15)
Binary Input
Vmin = -1 volts
Top
First Order Hold 4.18
time time
A first order hold voltage reconstruction does in fact produce a signal that is closer to the original in a mean
squared error sense. However building an electronic circuit that will generate a linearly increasing voltage
between two arbitrary input voltages is not trivial.
Hence we favour zero order hold. We can further note that the “problem” of the zero order hold (i.e the
squareness of the output voltage) can be corrected for later using a reconstruction and a sinx/x compensating
filter.
Top
Binary Data Wordlengths 4.19
• Note that data input from an ADC, or output to a DAC will always be
fixed point, although the internal DSP computation may be floating
point.
DSP processors used to process the data will use data wordlengths of 8 (more a microcontroller), 16, 24 or 32
bits. 32 bits is usually floating point, 24 bit mantissa, 8 bit exponent.
It is worth pointing out at this stage that the no. of bits resolution of an ADC or DAC can be increased by using
oversampling techniques. For example a 3 bit converter, could be “oversampled” to produce a sampled signal
that has resolution of 8 bits! Oversampling techniques will be discussed later in the course.
In general the arithmetic “modes” of DSP processors are straightforward unlike general purpose processors. In
a general purpose processor, arithmetic modes of 16 bit integer, 32 bit integer, 32 bit floating point, 64 bit
floating point etc are likely to be available. This is not the case for DSP processors. Although various arithmetic
modes could be programmed, in general the mode is fixed point, where the sign bit is the MSB (most significant
bit) and a binary point is placed after the MSB. Therefore for a 16 bit processor which has an integer numerical
range of – 32768 to 32767 , the numerical range with the binary point at position 15 is – 1 to 0.9999 , i.e.
1.000 0000 0000 0000 to 0.111 1111 1111 1111 .
Sampler
Voltage In Voltage Out
Generic DSP
In sampling this signal, we are clearly trying to ensure that we retain the information regarding the signal’s
amplitude, frequency and phase, the three components which characterise the signal.
As an alternative to representing a sine wave as an equation, e.g. “Sine wave amplitude spectra
Amplitude
y ( t ) = 10 sin ( 2π2300t + θ ) for a 2300 Hz sine wave of amplitude 10
volts and phase θ we can use a simple frequency domain representation
of a (sine wave amplitude) spectrum. (Note that this simple spectrum
does not represent phase information.) 2300 freq/Hz
If a signal is composed of a “few sine waves” then the spectrum may be “A few sine waves””
Amplitude
represented as illustrated, and if the signal is somewhat more aperiodic
and we can only identify the “average” or typical frequency content, then
we may use a continuous type spectrum
1000 2000 3000 freq/Hz
In effect the sine wave is the simplest type of time varying signal that
exists, and ANY real signal can be produced from a sum of suitable sine “Continuous Spectrum””
Amplitude
and cosine waves. Later in the course when we discuss Fourier analysis
it will be shown that any periodic signal can be decomposed into a sum
of sine waves of suitable frequencies, amplitudes and phases. These
frequency components actually form a mathematical basis for describing 1000 2000 3000 freq/Hz
the periodic signal. Hence in attempting to derive a sampling theorem it
is entirely appropriate that we start by finding a suitable rate for a fundamental single sinusoidal wave, and
extend the theorem from this point.
Top
Sampling - Too Fast? 4.21
Voltage
Amplitude
1
T s = ------------
1600
Ts
N = 15
0 1 2 ... sample,k
1-
-------- th sec
100
However when we sample the 100Hz sine wave at just above Nyquist, i.e. f s = 204Hz then this is high enough
to mathematically retain all information about ALL sine wave components that may be present from 0 to 100Hz
(actually 102 = f s ⁄ 2 ). But observing the join the samples view, it does not necessary look correct...... but it is.
Amplitude
N = 15
0 1 2 ... sample,k
1-
-------- sec
204
1-
-------- th sec
100
Top
Signal Frequency Range Terminology 4.24
Magnitude
⇒ f n = 2f b
f b = bandwidth
0 fb frequency/Hz
f l = lowest freq
⇒ f n = 2f h
f h = highest freq
fb = fh – fl 0
fl fh frequency/Hz
∞
sin ( πt ⁄ t s )
x(t) = ∑ x ( kt s )h ( t – kt s ) h ( t ) = ---------------------------
πt ⁄ t s
k = –∞
voltage
time
IIn practice true sinc interpolation is not possible to do (due to temporal contrants), hence as we will see later
we usually perform zero order hold followed by low pass filtering to recover the original signal.
Top
Nyquist Sampling Rate 4.25
Nyquist frequency, f n = 2f b
Magnitude
fb frequency/Hz
• In we require to sample this signal and retain all information, then the
sampling rate, f s must be chosen as:
Magnitude
we might be tempted to suggest that the sampling frequency
(according to the Nyquist criteria) is
f s = 2f bw = 2, 020, 000 Hz .
1000000 1010000 freq/Hz
However if we realise that we could “demodulate” this signal
Magnitude
f bw
to baseband and then sample, it would seem that we can find
some mathematical justification that the direct sampling rate “Demodulated Signal”
be only f s = 2f bw = 20, 000 Hz . Because the signal is
bandlimited, if we sample at 20000 kHz then the signal from 1 10, 000 freq/Hz
- 1.01 MHz will alias down to baseband and all signal
information retained.
Therefore we are effectively downsampling the signal by a factor of 50 and then sampling. Hence it is
appropriate to state that the sampling frequency required to sample any signal can be f s = 2f bw rather than
that predicted by the Nyquist criteria. The above signal could be sampled at 20000Hz (Note in this example for
simplicity we have carefully chosen the maximum frequency in the bandlimited signal and bandwidth to be
integer multiples of each other, in practice when this is not true the required sampling rate will be greater than
2f bw in cases where demodulation to baseband is NOT performed, i.e. the demodulation is implicitly done by
aliasing.)
This general process is called undersampling and is an area of considerable “DSP” activity at present with
respect to “software radio” for communication systems where the electromagnetic signal of interest (e.g. a
mobile phone in the high 100’s MHz’s) is demodulated to an intermediate frequency of around 1 MHz and then
sampled at a frequency rate of the order of 2f bw rather than 2f max . It is important to point out however that the
sampler required to accomplish undersampling, requires a bandwidth capability equivalent to f max given that
the obtained sample is essentially an integration over 1 ⁄ f max .
Top
Aliasing 4.26
Amplitude
0 time/s
Clearly this is above f s ⁄ 2 = 5000Hz and the 9000Hz will alias. The diagram illustrates that when we
reconstruct this signal we get a 1000Hz sine wave. Note that the phase has also shifted, and is now 180o out
of phase, compared to the phase of the input at 9000Hz.
From a knowledge of f s and the input frequencies it is straightforward to establish the frequency of the aliased
components for any input components above f s ⁄ 2 . This is presented in the next two slides.
Top
Aliasing Examples 4.27
f s = 1000Hz
900Hz + 100Hz +
Voltage In Voltage Out
750Hz + “Reconst” 250Hz +
600Hz x(t) Sampler xo (t) 400Hz
f s = 1000Hz
1100Hz + 100Hz +
Voltage In Voltage Out 250Hz +
1250Hz + “Reconst”
1400Hz y(t) yo (t) 400Hz
Sampler
Clearly the above system sampling at 1000Hz would be best limited to only have input signals with frequencies
below 500Hz.
Of course sometimes aliasing can be exploited in situations where perhaps we are aiming to demodulate a
signal. As we will discuss in the Software Radio section of notes, direct digital downconversion could be used
to “demodulate” (or alias down) from between 60 and 70kHz to 10kHz by taking only 20000 samples per second
(although the front end of the ADC must still be capable on integrating over a time interval that is commensurate
with the signal bandwidth).
10kHz
Amplitude
fs/2 fs
10 20 30 40 50 60 70 freq/Hz
If this signal is appropriately bandlimited, the output signal will alias to the same “shape” at baseband
frequencies:
Amplitude
10kHz
fs/2 fs
10 20 30 40 50 60 70 freq/Hz
Top
Aliased Spectra 4.28
Sampling frequency, fs = 1000Hz
Magnitude
Signal spectrum
w o ( t ) = 100 sin 2π100t + 50 sin 2π250t + 25 sin 2π400t
NO ALIASING
fs = 1000 freq/Hz
Aliased spectrum
Magnitude
Signal spectrum
x o ( t ) = – 100 sin 2π900t – 50 sin 2π750t + – 25 sin 2π600t
ALIASING
fs = 1000 freq/Hz
Aliased spectrum
Magnitude
Signal spectrum
y o ( t ) = 100 sin 2π1100t + 50 sin 2π1250t + 25 sin 2π1400t
ALIASING
fs = 1000 freq/Hz
Amplitude
w ( t ) at 1000 Hz we adhere to the Nyquist
criteria. We can represent the signal to be
sampled as a simple (sine wave amplitude)
spectrum: 1000 freq/Hz
w ( t ) = 100 sin 2π100t + 50 sin 2π250t + 25 sin 2π400t
Of course if we had sampled the the signal
Amplitude
Aliased spectrum
x ( t ) (i.e. sine waves at 900Hz, 750Hz and Signal spectrum
600Hz at 1000 Hz), then because Nyquist
criteria is not preserved, all of these sine
waves will alias respectively to 100, 250 and 1000 freq/Hz
400 Hz components. x ( t ) = 100 sin 2π900t + 50 sin 2π750t + 25 sin 2π600t
Similarly if we sampled the signal y ( t ) (i.e. Aliased spectrum
Amplitude
sine waves at 1100Hz, 1250Hz and 1400Hz)
Signal spectrum
at 1000 Hz, then because Nyquist criteria is
not preserved, all of these sine waves will
alias respectively to 100, 250 and 400 Hz 1000 freq/Hz
components. y ( t ) = 100 sin 2π1100t + 50 sin 2π1250t + 25 sin 2π1400t
We can then of course note the “pattern” of spectrum aliasing as shown below:
Amplitude
Baseband spectrum
fs ⁄ 2 fs freq/Hz
Top
Anti-Alias Filter 4.29
Analogue fs
Analogue Anti-Alias Filter
Processor
input voltage
To DSP
−
+
etc.... ADC
Magnitude
Magnitude
Attenuation
• The anti-alias filter is analogue (ideally a brick wall filter), cutting off
just before fs/2 Hz.
Generic DSP
Attenuation (dB)
0 -3dB cut off
Stopband attenuation
-40
fc frequency
3dB cut off frequency
V out V out
0dB corresponds to an attenunation of 1, i.e., if 20 log ------------ = 0 , then ------------ = 1 and therefore V out = V in .
V in V in
V out V out
- = – 40 , then ------------ = 0.01 and therefore V out = 0.01V in .
-40dB corresponds to 20 log -----------
V in V in
Top
Reconstruction Filter 4.30
time time
Analogue
Reconstruction
Filter Reconstruction filter
“Steppy/staircase” removes the high
output ananlogue − frequency signal
+
voltage from DAC Attenuation etc....
components. .
Magnitude
Magnitude
fs/2 freq
fs/2 freq fs/2 freq
Generic DSP
Note that the (time) impulse response (discussed later) of the Roll off rate = ∞
perfect brick wall filter is in fact a sinc function:
Attenuation
0dB
sin ( πt ⁄ t s )
---------------------------
πt ⁄ t s
H ZOH ( f ) 1
Frequency shaping characteristic of ZOH circuit
Attenuation
2/π
h ZOH ( t )
1
Impulse response of ZOH pulse
time
ts
and finding the frequency response (as shown in diagram in above slide) via a Fourier transform;
Hence the ideal reconstruction filter should compensate for the “sinx/x” “droop” at frequency f s ⁄ 2 by a factor of:
In practice of course such an analogue filter will not be produced, and as far as possible a close to ideal brick
wall filter will be used. In order to compenstate for the droop, we can actually introduce a digital filter before the
DAC to amplify the signal with the above inverse droop characteristic! And finally in the modern DSP world,
oversampling will be used to reduce the analogue complexity (see later....)
Top
Anti-alias and Reconstruction 4.32
• Ideally they are both very sharp cut off filters at frequency fs/2. In
practice the roll off will be between 6dB/octave (a simple resistor and
capacitor) to 96dB/octave (a 16th order filter).
G(f)
Magnitude
Filter gain roll-off
Pass
band
Cut-off frequency freq
f s > 2 × f max
Binary value
0.125 2
Volts 1
0 to Real 0
-1
-0.125 time, t Number -2 sample, n
-3
-0.25 -4
v ( n ) = s ( nt s ), for n = 0, 1, 2, …
August 2005, For Academic Use Only, All Rights Reserved
Notes:
In the above example the “converter” produces a real number value, i.e an input voltage of 1.10233 is output
as the real number 1.10233. Therefore the input/output characteristic of this system is:
1 Voltage
Input
• The ADC samples at the Nyquist rate, and the sampled data value is
the closest (discrete) ADC level to the actual value:
s(t) ^v(n) ts
0.25
fs 4
Binary value
3
0.125 2
Voltage
1
0 ADC 0
time
-1 sample, n
-0.125 -2
-3
-0.25 -4
v̂ ( n ) = Quantise { s ( nt s ) }, for n = 0, 1, 2, …
01111 (+15)
Binary Output
0.125 volts
Vmin = 1 volts
10000 (-16)
In the above slide figure, the second sample, the true sample value is 1.589998..., however our ADC quantises
to a value of 2.
Top
Quantisation Error 4.35
• If the smallest step size of a linear ADC is q volts, then the error of
any one sample is at worst q/2 volts.
01111 (+15)
Binary Output
q volts
10000 (-16)
V max
q = --------------
2N – 1
Binary 10000000 to 01111111, or in decimal -128 to 127 has a dynamic range of approximately 48 dB.
Top
Quantisation Error in a Signal 4.36
0
time
-1
-2
e(n)
q/2
-q/2 time
v̂ ( n ) = v ( n ) + e ( n )
The quantisation error of each sample is in the range ± q ⁄ 2 and we can model the quantiser as a linear additive
noise source.
e(n)
Sampler Binary
Voltage In Voltage out Samples out
s(t) v(n) v̂ ( n )
Analogue to Digital Converter
We can therefore use this as a simple linear equation model of our quantiser where v̂ ( n ) = v ( n ) + e ( n ) and
e ( n ) is a white noise source uncorrelated with the input signal v ( n ) . Note that for the actual quantiser it is not
possible to write a simple set of mathematical equations to describe/define its input/output. (Later in the course
(Dithering) we will see that the “uncorrelated white quantisation noise” assumption is not actually
generally true.....but thats for later and is a reasonable assumption for now.)
Top
Quantisation Error PDF 4.37
• Assuming the ADC rounds to the nearest digital level, the maximum
error of any one sample is q/2 volts.
-q/2 q/2 e
(In practice the quantisation error will be somewhat correlated with the input signal,
particularly for low level periodic signals. This will be discussed and addressed later in the
dithering section).
For example, if a signal source outputs a random variable that is uniformly distributed over the range -1 to 1 and
we take outputs and plot a histogram for ranges of 0.2, we may note that after observing, say 10000 samples
the histogram of output values is:
500
-1.0 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1.0 x(.)
The histogram is straightforward to interpret, e.g. in the last 10,000 samples, 983 have been in the range 0 to
0.2. In the limit if the signal is truely generated by a uniformly distributed random noise source, then as we
reduce the interval width to 0, and increase the no. of samples to an infinite (!) number, the pdf is as shown in
the slide.
• Consider the noise power or variance (in a 1 ohm resistor for a 1Hz
sampling rate) of the quantisation error signal from:
∞ q⁄2 q⁄2 2
1 q
n adc = ∫– ∞ e 2 p ( e ) de = ∫– q ⁄ 2 e 2 p ( e ) de = ------ e 3
3q –q ⁄ 2
= ------
12
Signal
Low level signals E(f)
of interest
may be masked by Quantisation Noise
the quantisation (theoretical only)
noise. q 2 ⁄ 12
----------------
fs ⁄ 2
ˆ (f) = V(f) + E(f)
V fs/2 frequency (Hz)
Return
The noise power can also be calculated from a time average rather than a statistical average. Taking N samples
(where N is large) of the quantisation error, the average power is simply:
N–1
Signal Energy 1 q2
Noise Power = ------------------------------------- = ----
Time N ∑ 2
e ( k ) ≈ ------
12
for large N
n=0
e(n) q/2
N-1 sample
-q/2
Average
e2(n) 2
q /4 q2/12
N-1 sample
Top
Quantisation Spectra 4.39
Signal Power
E(f)
q 2 ⁄ 12
----------------
fs ⁄ 2
Vˆ ( f ) = V ( f ) + E ( f )
fs/2 fs/2
V ( f ) and E ( f ) freq/Hz freq/Hz
Binary Output
2N – 1 – 1 2
Quantization q = ------
N
-
step size 2
-1 1
Analog Input
–2 N – 1
Therefore the mean square value of the quantisation noise power can be calculated as:
2 ⁄ 2 N ) 2
(--------------------- 4
Q N = 10 log = 10 log 2 – 2 N + 10 log ------ ≈ – 6.02N – 4.77 dB
12 12
Another useful measurement is the signal to quantisation noise ratio (SQNR). For the above ADC with voltage
input levels between -1 and +1 volts, if the input signal is the maximum possible, i.e. a sine wave of amplitude
1 volt, then the average input signal power is: Signal Power = E [ sin2 2πft ] = 1 ⁄ 2 . Therefore the maximum
SQNR is:
For a perfect 16 bit ADC the maximum SQNR can be calcuated to be 98.08 dB.
Top
Timing Jitter Error I 4.40
• Note that when a signal is sampled there may be some “jitter” on the
sampling clock which will cause additional sample error.
Voltage
time
Voltage
time
• With jitter each sampling instant may be slightly offset, and therefore
the sample value obtained and sent to the DSP will be in error.
• Sampling Theorem;