|
Digital
Signal Processing
-
Hardware
It is possible
to design one DSP based hardware configuration
which can be programmed to perform a very
wide variety of signal processing tasks,
simply by loading in different software.
For example, a digital filter may be reprogrammed
from a low pass to a high pass with no change
in hardware. In an analog system the whole
design would need to be changed. The ability
to perform these alterations by simple replacement
of a single memory device is a significant
advantage for DSP. Changing an analog signal
processing system is done by changing component
values, generally a soldering iron
job.
-
Stability
When we look
at the field performance of analog hardware
(i.e. how systems perform in use over a
period of time) the situation gets even
worse. The components in analog systems
including resistors, capacitors and operational
amplifiers all change there characteristics
with changes in temperature. This means
that an analog circuit may perform quite
differently a zero degrees Celsius than
it does at 75 degrees Celsius. Digital circuits
will show no variation with temperature
throughout their guaranteed operating range.
A third form of variability which affects
analog circuits is component ageing. Capacitors
in particular are prone to ageing or the
dielectric material. This will cause a change
in impedance and alter the behavior of the
circuit. Compensations have to be built
into the circuit to allow for component,
thermal and ageing variations. This can
greatly complicate the design process and
compromise overall circuit performance.
Putting all these in perspective, there
are many thousands of analog systems in
use for signal processing, so the problems
are by no means insurmountable. Nevertheless
they do exist and the use of a digital signal
processor removes these variables. Furthermore,
DSP circuits may even be programmed to detect
and compensate for changes in the analog
and mechanical part of a
complete system.
-
Repeatability
Digital systems
are inherently repeatable. If you would
test five hundred identical DSP circuits
they will all give precisely the same results.
If you would build five hundred analog signal
circuits, using components of identical
specification, you will not get the same
output from each circuit. The reason for
this is simple there is a spread of performance
of the components in the analog circuits.
|
|
Aliasing
|
Hilbert transform
|
|
|
|
| An
example of aliasing in the time domain. Notice
that the two signals have the same values at the
sampling instants, although their frequencies
are different. The red signal starts at DC and
goes to the nyquest frequency and the blue signal
goes from twice the nyquest frequency to the nyquest
frequency. The nyquest frequency is half the sample
rate.
Notice how the
signal folds around the nyquest frequency.
|
The Hilbert transform
is used to create a 90-degree phase shift. When
an X number of samples before the current sample
are multiplied by -1 and an X number of samples
after the current sample are multiplied by +1
a 90 degree phase shift can be created. This
is illustrated by multiplying the black and
red signal. The sum of these multiplication's
is plotted at the black vertical line in blue.
The sum of course in divided by the number of
sample to keep the same amplitude. To make this
work properly for different frequencies we use
different coefficients instead of -1 and +1.
|
|
|
Bilinear
transform
|
|
|
| The
bilinear z-transform is used to convert an analogue
filter into an equivalent digital filter by replacing
s as shown above. In most practical applications
s is close to one for which this transform works
quit well. |
|
|
Phase
shift
|
|
The formulas below
where used to simulate a two pole IIR filter.
Now lets feed in
an sinusoidal signal and change the frequency.

|
|
Fourier
transform
|
|
This
signal is constructed by adding sinusoidal
waveforms of the
following frequencies:
h = 1,3,5,7 using
the formula: 
|
| By
using more frequencies we get a better
approximation of a square wave.
Using
the same formula and the frequencies
h = 1,3,5,7,9,11,13,15 we get
the square wave
|

|
 |
If
we have the square wave and want to
know which sinusoidal frequencies are
with in this signal we can multiply
each point with in the signal by different
frequencies 1,2,3,4,5,6, |
| The
total amount of signal of the sinusoidal
frequency three times higher than the
frequency of the square wave is 1/3
of the sinusoidal frequency with the
same frequency as the square wave. This
shows how the amount of signal for all
different frequencies can be found.
This only works when the signals
are in phase. |
|
When
the signals are not in phase we multiply
the signal by a sine and cosine signal
as show on the right.Multiplying by
the cosine (Blue signal) will give
you the real value and by multiplying
with the sine (Green signal) we get
the imaginary value. To get the amount
(magnitude) we use pythagoras: The
angle between the sine and the cosine
will give you the phase.
|
 |
The Fast Fourier Transform
(FFT) is a method in which point of the same
amplitude but different frequencies are used
only ones in a multiplication instead of for
each frequency. This reduces the amount of
computation required to calculate the FFT.
This also requires a power of two (…256,512,1024,)
range of points to calculate the FFT over.
The result of the FFT and the described method
above, multiplying all the points within the
signal with all the points in a sine and cosine
of different frequencies, will give the same
result except the FFT is faster.
The complex Form
of a Fourier Series


|
Ok
impressed already?
Lets do
some testing using our advanced programmable
calculator CplxCalPro
for the palm pilot.
FFT
calculations
|

Above an
actual screen shot of the program using
CplxCalPro
version 2.00
The green
signal is the test signal. This signal
is multiplied by a sinusoidal signal,
y1, in the program and the result is
drawn in red. The resulting values are
added and stored in the variable Imag.
The green
signal is also multiplied by a cosine
signal, y2, and the result is drawn
in blue. The resulting values are added
and stored in the variable Real.
The last
part of the program shows the result.
Notice
that the resulting angle is -34 and
not 124 as you might expect. This is
correct!
Do
you know why?
If you
don't know why just change the phase
and see what happens or email
us for the answer.
|
FFT
calculate
Phase=124 // Change phase of test
signal.
fmt(0,6,6,0)
stdeg()
gtitl('Fourier calculation',0)
Xmin=0 ;Xmax=360
Ymin=-1 ;Ymax=1
gstdc(0,15,159,100)
gx=(Xmax-Xmin)/6
gxlbl(0,3,0,0)
gy=(Ymax-Ymin)/4
gylbl(0,3,2,0)
gaxis(Xmin,Ymin,Xmax,Ymax,gx,gy)
N=100
Step=(Xmax-Xmin)/N
x=Xmin
Real=0
Imag=0
while(x<=Xmax)
{
y3=sin(x+Phase)
y1=sin(x)
Imag=Imag+y1*y3
y2=cos(x)
Real=Real+y2*y3
if(x==0)
{
gmove(x,y1)
gmove2(x,y2)
gmove3(x,y3)
}
else
{
glin(x,y1*y3)
glin2(x,y2*y3)
glin3(x,y3)
}
x=x+Step
}
greset() // Rest the coordinates mapping.
x=80
y=125
mul=25
Real=Real/(N/2)
Imag=Imag/(N/2)
gfcir(x,y,mul) // Fill circle function.
yMul=y-Imag*mul
xMul=x+Real*mul
gline(x,y,x,yMul)
gline2(x,y,xMul,y)
gline3(x,y,xMul,yMul)
fmt(0,3,2,0)
gselcol(2)
grprt(30,105,'Real=',Real)
gselcol(1)
grprt(30,130,'Imag=',Imag)
gselcol(15)
v=Real+j*Imag
gselcol(3)
grprt(140,105,'Angle=',arg(v))
grprt(140,130,'Mag=',abs(v)) |
Version 2.00 also has
a build-in FFT function that is used
in the following program.
FFT
function
|
|

Wait till the text in
the button changes to Continue. This
takes about 8 seconds.

The x,y coordinates at the bottom of
the screen appear when you tap on the
graph.
Notice
the autoscaling of the srplot() function.
|
FFT
function
datafile='fft_data'
N=sdata(datafile)
srplot(1,1,N,0)
gtitl('Raw data',0)
gprt(44,146,'Wait for cont.=>',0)
fft(1,N)
// The real values are stored in
// column one and the imaginary
// values are stored in column two.
i=1
while(i<=N)
{
// Calculate the absolute values
and
// store them in column three.
sadd(i,3,abs(scget(i,1)))
i=i+1
}
gcont()
srplot(3,1,N/2,0)
gtitl('Magnitude',0)
gcprt(100,125,'Frequency',0)
|
|
|