Você está na página 1de 14

Pseudo-Random Binary

Sequences and impulse


responses
Technical Report
Michael Prior-Jones
Summary
This report details the theories of pseudo-random binary sequences
and cross-correlation and describes how they may be applied to
fnd the impulse responses of linear systems. The document also
describes a laboratory experiment used to demonstrate the
feasibility of using this technique to measure the impulse response
of a simple RC flter.
The technique can be demonstrated to work, although it is
recommended that a longer R!" and a higher clock speed be used
in any further work. #t is also suggested that the analogue
technique used in the experiment be replaced by a software
solution, either on a C or on a fast embedded microprocessor.
age $ of $%
Pseudo-Random Binary
Sequences and impulse
responses
Technical Report
Michael Prior-Jones
Contents
$ #ntroduction................................................................................&
$.$ !ackground...........................................................................&
$.' Report "tructure...................................................................&
' Theory of seudo-Random !inary "equences............................%
& Theory of Cross-correlation and system identifcation...............(
% )etails of demonstration system.................................................*
+ Conclusions...............................................................................$'
+.$ )iscussion and recommendations......................................$'
+.' ,ull circuit diagram of R!" generators and control logic$&
( !ibliography..............................................................................$%
age ' of $%
Pseudo-Random Binary
Sequences and impulse
responses
Technical Report
Michael Prior-Jones
1 Introduction
1.1 Background
The Research and )e-elopment department has been carrying out
a feasibility study on the process of measuring acoustic impulse
responses using pseudo-random binary sequences. This report
details work done to date on this pro.ect, together with
recommendations for future product de-elopment.
1.2 Report Structure
"ections ' and & deal with the theories of R!" generation and
correlation. "ection % details a laboratory experiment designed to
measure the impulse response of an RC flter using these theories.
"ection + contains some recommendations for future de-elopments
in this pro.ect.
age & of $%
2 Theory of Pseudo-Random Binary
Sequences
/0hite noise1 is the term gi-en to completely random
unpredictable noise, such as the hiss you hear on an untuned radio.
#t has the property of ha-ing components at e-ery frequency. 2
pseudo-random binary sequence 3R!"4 can also ha-e this
property, but is entirely predictable. 2 R!" is rather like a long
recurring decimal number- it looks random if you examine a short
piece of the sequence, but it actually repeats itself e-ery m bits. 5f
course, the larger m is, the more random it looks.
6ou can generate a R!" with a shift register and an 75R gate.
Connecting the outputs of two stages of the shift register to the
75R gate, and then feeding the result back into the input of the
shift register will generate a R!" of some sort. "ome
combinations of outputs produce longer R!"s than others- the
longest ones are called m-sequences 3where m means /maximum
length14.
,or a six-stage shift register, you can generate a (&-bit R!" by
connecting outputs + and ( to the 75R gate- as shown in fgure $.
=1
Clock
Output
Direction of shift
D Q D Q D Q D Q D Q D Q
Figure 1
5b-iously, it8s possible to get a longer m-sequence using more
stages to the shift register. The formula connecting these is9
1 2 =
n
m
0here m is the length of the m-sequence and n is the number of
shift register stages.
age % of $%
There is one state 3known as the forbidden state4, which does not
form part of the m-sequence. This is the state where all of the shift
registers contain :ero. #n this situation, the circuit outputs :eroes.
This condition can be trapped using some extra logic, shown in the
re-ised circuit of fgure '.
=1
Clock
Output
Direction of shift
1
1
D Q D Q D Q D Q D Q D Q
Figure 2
age + of $%
3 Theory of Cross-correlation and
system identifcation
The impulse response of a system is a useful description of its
beha-iour- it describes how the systems output -aries with time if a
unit impulse is fed into it. 2 unit impulse is defned as being of :ero
width and infnite amplitude, but with unit area. ,or this reason, a
unit impulse is not a practical signal to generate, let alone feed into
a system;
5ne could use an approximate unit impulse, but se-eral problems
would occur9
most systems would be o-erloaded by such a large signal,
and might be damaged
e-en if the system is not damaged, it is unlikely to maintain
its normal characteristics when dri-en with such an abnormal
signal.
<owe-er, R!"s can help us here9 we can feed a R!" into our
system and compare the output with the original R!", using a
technique called cross-correlation.
Correlation is the process of measuring similarity. Two wa-eforms
will correlate strongly if they are of a similar shape. ,or example,
sine wa-es and cos wa-es correlate strongly, because they are the
same shape but => degrees out of phase.
Cross-correlation in-ol-es comparing one wa-eform with a
di?erent one 3this is distinct from autocorrelation, where you
compare the wa-eform with itself4. 6ou perform the correlation by
time-shifting one wa-eform by a range of -alues, and for each time
shift you multiply the wa-es together. The resultant function
describes the similarity of the two wa-es as one shifts with respect
to the other. @quation $ gi-es the mathematics of this9


+ = dt t y t x r
xy
) ( ) ( ) (
Equation 1
#n this equation9
x3t4 and y3t4 are the functions being correlated
r
xy
34 is the cross-correlation function
is the time shift under consideration
5ne of the properties of this process is that when the two
wa-eforms match, you get a peak in the function at the time shift
where they match. Correlating a totally random signal against itself
produces :ero, except at the point where the time shift is :ero.
2 R!" will only correlate well against itself when it8s time shifted
by an integer multiple of the sequence length.
0hen the R!" is fed into a linear, time-in-ariant system 3such as
an RC flter4, the output of the circuit consists of a number of
age ( of $%
copies of the signal all at di?erent amplitudes and time shifts. #f
you could separate out all of the di?erent time shifts and measure
their amplitudes, you could draw the impulse response 3amplitude
against time shift4.
<owe-er, it is possible to use correlation to separate out all the
di?erent signals. #f you correlate the output signal against the
original R!", o-er a wide range of time shifts, the correlation
function will eliminate all of the signals except the component at
the current time shift. The output will then be proportional to the
amplitude of the component at that particular time shift.
The upshot of all this is that cross-correlating the output of a linear
system against a R!" fed into its input will generate the impulse
response. 2n ob-ious technique to doing this would be using a
computer with dual-channel analogue-to-digital con-erters9 the
original R!" is fed into one channel, and the system output is fed
into the other. The computer can then sample the output o-er a
defned time-period 3ideally one shorter than the R!" length4 and
perform the correlation by shifting the original R!" with respect
to the output signal.
There is another method, howe-er, and this was the one that we
used in the lab.
age A of $%
4 etails of demonstration system
2 block diagram of the lab system is shown in fgure &9
Clock
generator
Continuous
PRBS
generator
Interrupted
PRBS
generator
Clock
interrupt
logic
Sample
& Reset
signal logic
Correlator
!odule
CRO
S"stem
under
in#estigation
$RC %ilter&
S'!P() & R)S)*
!
a
i
n

C
l
o
c
k
PRBS
Interrupted
PRBS
Interrupted
Clock
Ripple
Carr" Out
S"stem
response
Figure 3
,or our lab experiment, we built a straightforward %-bit R!"
generator 3this generates a $+-bit long sequence4 using four stages
of a A%B"$(% *-bit shift register and a A%B"*( quad two-input 75R
gate. This is shown in fgure %, including the extra anti-lockup
circuitry9
=1
Clock
Output
Direction of shift
1 1
D Q D Q D Q D Q
Figure 4
The correlation method used was an interesting piece of analogue
computing. 2 third-party correlator module 3containing an
analogue multiplier and integrator4 was used to carry out the
correlation calculation and send a signal to an oscilloscope for
age * of $%
display. The correlator required a number of logic signals in order
to carry out the calculation. #n order to do the time shifting, a
modifed R!" is gi-en to the correlator as a reference. This
sequence has a one-bit delay introduced at the end of each
sequence, so it shifts with respect to the main R!" 3which is being
fed through the RC flter4 and is only in-phase e-ery $( cycles.
There8s also a "2CB@ signal that must be generated, at the end of
each R!" cycle, which the correlator to output to the scope as its
fnished its integration. #n the clock cycle following "2CB@, a
R@"@T signal is sent to discharge the integration capacitor ready
for the next calculation.
To generate the delayed R!", we built a second R!" generator
3as fgure &4 and used a %-bit counter #C 3A%B"$(&4 to count the
cycles. This chip has a Ripple Carry 5ut line 3RC54 which goes high
when the count rolls around from $$$$ to >>>>. This signal is used
to inhibit the clock on the generator using an 5R gate, as shown in
fgure +.
+,(S1-.
1
RCO
Clock in
Interrupted clock to
PRBS generator
Figure 5
This circuit generates an interrupted clock signal, which holds high
e-ery $( cycles, as shown by the timing diagram in fgure (.
1/ 1, 1. 10 1 1 0 .
!ain clock
Interrupted clock
Count
Figure 6
The R!" generator8s output is thus inhibited at the end of e-ery
sequence, allowing it to fall behind the uninhibited generator by
one bit for e-ery sequence.
age = of $%
The control signals 3"2CB@ and R@"@T4 for the correlator module
need a timing diagram looking like fgure A.
1/ 1, 1. 10 1 1 0 .
!ain clock
Count
S'!P()
R)S)*
Figure 7
To achie-e this, a single )-type was used to create a one-clock
delayed copy of the RC5 signal from the counter. This was then
used to dri-e the clock-inhibitor 3fgure %4 and formed the R@"@T
signal. The original RC5 signal became the "2CB@ signal.
This logic is shown in fgure *, together with the clock-inhibitor
logic.
1
RCO
Clock in
Interrupted clock to
PRBS generator
+,(S1-.
Q D
S'!P()
R)S)*
Figure 8
age $> of $%
The circuit tested was an RC flter circuit, with R being &k= and C
being A(n,. The theoretical impulse response of this circuit is
shown in fgure =.
Theoretical impulse response of RC filter
1
011
,11
-11
211
1111
1011
1,11
111)311 111)41, 011)41, .11)41, ,11)41, /11)41, -11)41, +11)41,
Time
A
m
p
l
i
t
u
d
e
The result seen on the oscilloscope as a result of using this system
looked like fgure $>.
*ime
'mplitude
Figure 10
This is quite a good approximation, although it8s quite steppy. 0ith
a faster clock speed and a longer R!" a better approximation
would be achie-ed.
age $$ of $%
Figure 9
! Conclusions
5.1 Discussion and recommendations
The experiments carried out demonstrate the feasibility of
measuring impulse responses using pseudo-random binary
sequences and cross-correlation. The method used in the lab is
inexpensi-e and relati-ely straightforward, although the
requirement for an oscilloscope to display the output trace may
outweigh the cost benefts of doing the computing in analogue
hardware. 2n alternati-e method would be to incorporate a
computer of some kind into the system, either a C or a fast
microprocessor system. The correlation could then be done in
software, and the only hardware requirement is the R!"
generator. #ndeed, by using a high-speed embedded microprocessor
system, one could build a portable instrument capable of displaying
the impulse response on a small BC) screen, and then sa-ing the
results back to a C for later perusal.
The resolution of the system should be addressed, using a longer
R!" and a higher clock speed. #t would ob-iously be necessary to
calibrate the instrument, so that the amplitudes and times may be
read o? accurately by the user.
age $' of $%
5.2 Full circuit diagram of PRBS generators and control logic
1
RCO
Clock in
Interrupted clock to
PRBS generator
+,(S1-.
Q D
S'!P() R)S)*
=1
1 1
D Q D Q D Q D Q
=1
1 1
D Q D Q D Q D Q
PRBS to s"stem
under in#stigation
Interrupted PRBS to
correlator
Control lines to correlator
age $& of $%
" Bi#lio$ra%hy
Tew, 2. #. 3'>>>4. )igital "equences, Correlation and Binear
"ystems, Dni-ersity of 6ork.
<orowit:, . E <ill, 0. 3$=*=4. The 2rt of @lectronics, Cambridge
Dni-ersity ress, '
nd
edition.
age $% of $%

Você também pode gostar