Digital Signal Processing And Its Benefits

advertisement
EEE 420
Digital Signal Processing
Instructor : Erhan A. Ince
E-mail: erhan.ince@emu.edu.tr
Web page address:
http://faraday.ee.emu.edu.tr/eee420
http://faraday.ee.emu.edu.tr/eaince
Digital Signal Processing And Its Benefits
By a signal we mean any variable that carries or contains some kind of
information that can be conveyed, displayed or manipulated.
Examples of signals of particular interest are:
-
speech, is encountered in telephony, radio, and everyday life
-
biomedical signals, (heart signals, brain signals)
2.6
2.4
2.2
2
1.8
1.6
1.4
1.2
1
0.8
0
•
1
2
3
4
5
6
7
8
ECG
Tomography
Significant features of ECG waveform
• A typical scalar electrocardiographic lead is shown in
Fig. 1, where the significant features of the waveform are
the P, Q, R, S, and T waves, the duration of each wave,
and certain time intervals such as the P-R, S-T, and Q-T
intervals.
•
Sound and music, as reproduced by the compact disc player
•
Video and image,
•
Radar signals, which are used to determine the range and bearing of distant targets
•Most of the signals in our environment are analog
such as sound, temperature and light
•To processes these signals with a computer, we
must:
1. convert the analog signals into electrical signals, e.g.,
using a transducer such as a microphone to convert
sound into electrical signal
2. digitize these signals, or convert them from analog to
digital, using an ADC (Analog to Digital Converter)
Steps in Digital Signal Processing
•Analog input signal is filtered to be a band-limited
signal by an input lowpass filter
•Signal is then sampled and quantized by an ADC
•Digital signal is processed by a digital circuit, often a
computer or a digital signal processor
•Processed digital signal is then converted back to an
analog signal by a DAC
•The resulting step waveform is converted to a smooth
signal by a reconstruction filter called an anti-imaging
filter
Why do we need DSPs
• DSP operations require a lot of multiplying and adding
operations of the form:
A = B*C + D
• This simple equation involves a multiply
and an add operation
• The multiply instruction of a GPP is very
slow compared with the add instruction
• Motorola 68000 microprocessor uses
10 clock cycles for add
74 clock cycles for multiply
• Digital signal processors can perform the
multiply and the add operation in just one clock
cycle
 Most DSPs have a specialized instruction
that causes them to multiply, add and save
the result in a single cycle
 This instruction is called a MAC (Multiply,
Add, and Accumulate)
Attraction of DSP comes from key advantages such as :
* Guaranteed accuracy: (accuracy is only determined by the number of bits used)
* Perfect Reproducibility: Identical performance from unit to unit
ie. A digital recording can be copied or reproduced several times with no
loss in signal quality
* No drift in performance with temperature and age
* Uses advances in semiconductor technology to achieve:
(i) smaller size
(ii) lower cost
(iii) low power consumption
(iv) higher operating speed
* Greater flexibility: Reprogrammable , no need to modify the hardware
* Superior performance
ie.
linear phase response can be achieved
complex adaptive filtering becomes possible
Disadvantages of DSP
* Speed and Cost
DSP techniques are limited to signals with relatively low bandwidths
DSP designs can be expensive, especially when large bandwidth signals
are involved.
ADC or DACs are either to expensive or do not have sufficient
resolution for wide bandwidth applications.
* DSP designs can be time consuming plus need the necessary resources
(software etc)
* Finite word-length problems
If only a limited number of bits is used due to economic considerations
serious degradation in system performance may result.
 The use of finite precision arithmetic makes it necessary
to quantize filter calculations by rounding or truncation.
 Roundoff noise is that error in the filter output that results
from rounding or truncating calculations within the filter.
 As the name implies, this error looks like low-level noise
at the filter output
Application Areas
Image Processing
Instrumentation/Control
Pattern recognition
spectrum analysis
Robotic vision
noise reduction
Image enhancement
data compression
Facsimile
position and rate
animation
control
Telecommunications
Echo cancellation
Adaptive equalization
ADPCM trans-coders
Spread spectrum
Video conferencing
Speech/Audio
speech recognition
speech synthesis
text to speech
digital audio
equalization
Biomedical
patient monitoring
scanners
EEG brain mappers
ECG Analysis
X-Ray storage/enhancement
Military
secure communications
radar processing
sonar processing
missile guidance
Consumer applications
cellular mobile phones
UMTS
digital television
digital cameras
internet phone
etc.
Key DSP Operations
1.
2.
3.
4.
5.
Convolution
Correlation
Digital Filtering
Discrete Transformation
Modulation
Convolution
Convolution is one of the most frequently used operations in DSP. Specially in digital filtering
applications where two finite and causal sequences x[n] and h[n] of lengths N1 and N2 are
convolved
y[n]  h[n]  x[n] 
where, n = 0,1,…….,(M-1)


k  
k 0
 h[k ]x[n  k ]   h[k ]x[n  k ]
and
M = N1 + N2 -1
This is a multiply and accumulate operation and DSP device manufacturers
have developed signal processors that perform this action.
Correlation
There are two forms of correlation :
1. Auto-correlation
2. Cross-correlation
For sampled signal (i.e. sampled signal), the
autocorrelation is defined as either
biased or unbiased defined as follows:
Correlation coefficient for discrete signals
Normalized version of the cross-covarience is
known as the correlation coefficient and is defined
as below
 xy n  
rxy n 
r 0r 0
1
xx
n  0,1,2,...
2
yy
Where, rxy(n) is an estimate of the cross-covarience
The cross-covarience is defined as
 1 N n 1
x[k ] y[k  n]
n  0,1,2,...
 N 
rxy n    N  nk10
1
  x[k  n] y[k ]
n  0,1,2,...
 N k 0
1 N 1
2
rxx (0)   x[k ]
N k 0
1 N 1
2
, ryy (0)    y[k ]
N k 0
Example 1: Autocorrelation of a sinewave Plot the autocorrelation sequence of a sinewave with
frequency 1 Hz, sampling frequency of 200 Hz.
The Matlab program is listed below:
N=1024; % Number of samples
f1=1; % Frequency of the sinewave
FS=200; % Sampling Frequency
n=0:N-1; % Sample index numbers
x=sin(2*pi*f1*n/FS); % Generate the signal,
x(n) t=[1:N]*(1/FS); % Prepare a time axis
subplot(2,1,1); % Prepare the
figure plot(t,x); % Plot x(n) title('Sinwave of frequency 1000Hz
[FS=8000Hz]');
xlabel('Time, [s]'); ylabel('Amplitude'); grid;
Rxx=xcorr(x); % Estimate its autocorrelation
subplot(2,1,2); % Prepare the figure plot(Rxx);
% Plot the autocorrelation grid;
title('Autocorrelation function of the sinewave');
xlable('lags');
ylabel('Autocorrelation');
A=[ones(1,4),zeros(1,8),ones(1,8)];
A2=filter([0,0,0,0,0,1],1,A);
[acor , lags]= xcorr(A,A2);
subplot(3,1,1) ,stem(A), title('Original signal A');
subplot(3,1,2) ,stem(A2), title('Sample shifted signal A2');
subplot(3,1,3), stem(lags,acor/length(A))
title('Full cross-correlation of A and A2');
Original signal A
1
0.5
0
0
2
4
6
8
10
12
14
16
18
20
14
16
18
20
Sample shifted signal A2
1
0.5
0
0
2
4
6
8
10
12
Full cross-correlation of A and A2
0.4
0.2
0
-20
-15
-10
-5
0
5
10
15
20
Digital Filtering
The equation for finite impulse response (FIR) filtering is
N 1
y[n]   h[k ]x[n  k ]
k 0
Where, x[k] and y[k] are the input and output of the filter respectively and h[k]
for k = 0,1,2,………,N-1 are the filter coefficients
N 1
yn   bk  xn  k 
k 0
-1
z
x(n)
x
b0
-1
z
x
+
b1
-1
z
x
b2
+
-1
z
x
bN-1
+
Filter structure
A common filtering objective is to remove or reduce noise from a wanted signal.
y(n)
(a)
(d)
(b)
(c)
(e)
(f)
Figure : Reconstructed bi-level text images for degradation caused by h1 and AWGN.
(a) Original, (b) 2D Inverse, (c) 2D Wiener, (d)PIDD, (e) 2D VA-DF, (f) PEB-FCNRT
Discrete Transformation
Discrete transforms allow the representation of discrete-time signals in the
frequency domain or the conversion between time and frequency domain
representations.
Many discrete transformations exists but the discrete Fourier transform (DFT) is
the most widely used one.
DFT is defined as:
N 1
X (k )   x[n]W
nk
where W  e
 j 2
N
n 0
IDFT is defined as:
1 N 1
x[n]   X (k )WNkn ,
N k 0
0  n  N 1
MATLAB function for DFT
function [Xk] = dft(xn)
N=length(xn);
n = 0:1:N-1; % row vector for n
k = 0:1:N-1; % row vecor for k
WN = exp(-1*j*2*pi/N); % Twiddle factor (w)
nk = n'*k; % creates a N by N matrix of nk values
WNnk = WN .^ nk; % DFT matrix
Xk = (WNnk*xn' );
Matlab Function for IDFT
function [xn] = idft(Xk)
% Computes Inverse Discrete Transform
% ----------------------------------% [xn] = idft(Xk)
% xn = N-point sequence over 0 <= n <= N-1
% Xk = DFT coeff. array over 0 <= k <= N-1
% N = length of DFT
%
N = length(Xk);
n = [0:1:N-1];
% row vector for n
k = [0:1:N-1];
% row vecor for k
WN = exp(-j*2*pi/N);
% Wn factor
nk = n'*k;
% creates a N by N matrix of nk values
WNnk = WN .^ (-nk);
% IDFT matrix
xn = abs(Xk' * WNnk')/N;
% row vector for IDFT values
Example
Let x[n] be a 4-point sequence
 1, 0  n  3
x[n]  
0, otherwise
>>x=[1, 1, 1, 1];
>>N = 4;
>>X = dft(x,N);
>>magX = abs(X) ;
>>phaX = angle(X) * 180/pi;
magX=
4.0000
0.0000
0.0000
0.0000
0
-134.981 -90.00
-44.997
phaX=
Modulation
Discrete signals are rarely transmitted over long distances or stored in large
quantities in their raw form.
Signals are normally modulated to match their frequency characteristic to
those of the transmission and/or storage media to minimize signal distortion,
to utilize the available bandwidth efficiently, or to ensure that the signal have
some desirable properties.
Two application areas where the idea of modulation is extensively used are:
1. telecommunications
2. digital audio engineering
High frequency signal is the carrier
The signal we wish to transmit is the modulating signal
Three most commonly used digital modulation schemes for transmitting
Digital data over bandpass channels are:
Amplitude shift keying (ASK)
Phase shift keying (PSK)
Frequency shift keying (FSK)
When digital data is transmitted over an all digital network a scheme known
As pulse code modulation (PCM) is used.
Download