100% found this document useful (1 vote)
35 views

A Practical Guide to Error Control Coding Using MATLAB Yuan Jing pdf download

The document is a practical guide to error control coding using MATLAB, aimed at engineers and university students. It covers various coding techniques, including binary block codes, Reed-Solomon codes, and convolutional codes, while emphasizing the implementation of decoding algorithms. The book includes over 90 MATLAB programs for readers to experiment with and focuses on concepts rather than mathematical proofs.

Uploaded by

virtsalfre
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
35 views

A Practical Guide to Error Control Coding Using MATLAB Yuan Jing pdf download

The document is a practical guide to error control coding using MATLAB, aimed at engineers and university students. It covers various coding techniques, including binary block codes, Reed-Solomon codes, and convolutional codes, while emphasizing the implementation of decoding algorithms. The book includes over 90 MATLAB programs for readers to experiment with and focuses on concepts rather than mathematical proofs.

Uploaded by

virtsalfre
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

A Practical Guide to Error Control Coding Using

MATLAB Yuan Jing download

https://ebookname.com/product/a-practical-guide-to-error-control-
coding-using-matlab-yuan-jing/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Error Control Coding 2nd Edition Shu Lin

https://ebookname.com/product/error-control-coding-2nd-edition-
shu-lin/

Essentials of Error Control Coding 1st Edition Jorge


Castiñeira Moreira

https://ebookname.com/product/essentials-of-error-control-
coding-1st-edition-jorge-castineira-moreira/

Managing maintenance error a practical guide 1st


Edition Hobbs

https://ebookname.com/product/managing-maintenance-error-a-
practical-guide-1st-edition-hobbs/

Special Tests for Neurologic Examination 1st Edition


James Scifers

https://ebookname.com/product/special-tests-for-neurologic-
examination-1st-edition-james-scifers/
Tradition Book Cult of Ecstasy Mage The Ascension Lynn
Davis

https://ebookname.com/product/tradition-book-cult-of-ecstasy-
mage-the-ascension-lynn-davis/

The Reproduction of Colour 6th Edition R. W. G. Hunt

https://ebookname.com/product/the-reproduction-of-colour-6th-
edition-r-w-g-hunt/

Mockingbird Song Ecological Landscapes of the South 1st


Edition Jack Temple Kirby

https://ebookname.com/product/mockingbird-song-ecological-
landscapes-of-the-south-1st-edition-jack-temple-kirby/

Urban Environments for Healthy Ageing A Global


Perspective 1st Edition Anna Lane (Editor)

https://ebookname.com/product/urban-environments-for-healthy-
ageing-a-global-perspective-1st-edition-anna-lane-editor/

The U S Navy SEAL Survival Handbook Learn the Survival


Techniques and Strategies of America s Elite Warriors
US Army Survival 1st Edition Mann

https://ebookname.com/product/the-u-s-navy-seal-survival-
handbook-learn-the-survival-techniques-and-strategies-of-america-
s-elite-warriors-us-army-survival-1st-edition-mann/
Markets and Market Liberalization Ethnographic
Reflections 1st edition Edition Dannhaeuser N. (Ed.)

https://ebookname.com/product/markets-and-market-liberalization-
ethnographic-reflections-1st-edition-edition-dannhaeuser-n-ed/
A Practical Guide to Error-Control
Coding Using MATLAB®
DISCLAIMER OF WARRANTY
The technical descriptions, procedures, and computer programs in this book
have been developed with the greatest of care and they have been useful to the
author in a broad range of applications; however, they are provided as is,
without warranty of any kind. Artech House, Inc. and the authors and editors
of the book titled A Practical Guide to Error-Control Coding Using MATLAB®
make no warranties, expressed or implied, that the equations, programs, and
procedures in this book or its associated software are free of error, or are
consistent with any particular standard of merchantability, or will meet your
requirements for any particular application. They should not be relied upon
for solving a problem whose incorrect solution could result in injury to a
person or loss of property. Any use of the programs or procedures in such
a manner is at the user’s own risk. The editors, author, and publisher dis-
claim all liability for direct, incidental, or consequent damages resulting from
use of the programs or procedures in this book or the associated software.
A Practical Guide to Error-Control
Coding Using MATLAB®

Yuan Jiang

artechhouse.com
Library of Congress Cataloging-in-Publication Data
A catalog record for this book is available from the U.S. Library of Congress.

British Library Cataloguing in Publication Data


A catalogue record for this book is available from the British Library.

ISBN 13: 978-1-60807-088-6

Cover design by Patrick McCarthy

© 2010 ARTECH HOUSE


685 Canton Street
Norwood, MA 02062

All rights reserved. Printed and bound in the United States of America. No part of
this book may be reproduced or utilized in any form or by any means, electronic or
mechanical, includ­ing photocopying, recording, or by any information storage and
retrieval system, without permission in writing from the publisher.
All terms mentioned in this book that are known to be trademarks or service
marks have been appropriately capitalized. Artech House cannot attest to the ac-
curacy of this informa­tion. Use of a term in this book should not be regarded as
affecting the validity of any trade­mark or service mark.

10 9 8 7 6 5 4 3 2 1
Contents

Preface ix

1 Error Control in Digital Communications


and Storage 1

1.1 Error Control Coding at a Glance 1


1.1.1 Codes for Error Control 1
1.1.2 Important Concepts 5

1.2 Channel Capacity and Shannon’s Theorem 14

1.3 Considerations When Selecting


Coding Schemes 16

References 17
Selected Bibliography 17

2 Brief Introduction to Abstract Algebra 19

2.1 Elementary Algebraic Structures 19


2.1.1 Group 19
2.1.2 Field 22

vi A Practical Guide to Error-Control Coding Using MATLAB®

2.2 Galois Field and Its Arithmetic 25


2.2.1 Galois Field 25
2.2.2 Arithmetic in GF (2m) 33

2.3 Implementation of GF (2m) Arithmetic 36


2.3.1 Arithmetic with Polynomial Representation 36
2.3.2 Arithmetic with Power Representation 39
2.3.3 A Special Case: Inversion 40

Problems 43
References 44
Selected Bibliography 44

3 Binary Block Codes 45

3.1 Linear Block Codes 45


3.1.1 Code Construction and Properties 45
3.1.2 Decoding Methods 51
3.1.3 Performance of Linear Block Codes 60
3.1.4 Encoder and Decoder Designs 65
3.1.5 Hamming Codes 66

3.2 Cyclic Codes 73


3.2.1 Basic Principles 74
3.2.2 Shift Register–Based Encoder and Decoder 81
3.2.3 Shortened Cyclic Codes and CRC 91

3.3 BCH Codes 95


3.3.1 Introduction 97
3.3.2 BCH Bound and Vandermonde Matrix 100
3.3.3 Decoding BCH Codes 101

Problems 110
References 111
Selected Bibliography 112
Contents vii

4 Reed-Solomon Codes 113

4.1 Introduction to RS Codes 113


4.1.1 Prelude: Nonbinary BCH Codes 113
4.1.2 Reed-Solomon Codes 117

4.2 Decoding of RS Codes 123


4.2.1 General Remarks 123
4.2.2 Determining the Error Location Polynomial 124
4.2.3 Frequency-Domain Decoding 135
4.2.4 Error and Erasure Decoding 140

4.3 RS Decoder: From Algorithm to


Architecture 143
4.3.1 Syndrome Computation Circuit 143
4.3.2 Architectures for Berlekamp-Massey
Algorithm 143
4.3.3 Circuit for Chien Search and Forney’s
Algorithm 149

4.4 Standardized RS Codes 149

Problems 150
References 151

5 Convolutional Codes 153

5.1 Fundamentals of Convolutional Codes 153


5.1.1 Code Generation and Representations 153
5.1.2 Additional Matters 161

5.2 Decoding of Convolutional Codes 165


5.2.1 Optimum Convolutional Decoding
and Viterbi Algorithm 166
5.2.2 Sequential Decoding 179
viii A Practical Guide to Error-Control Coding Using MATLAB®

5.3 Designing Viterbi Decoders 189


5.3.1 Typical Design Issues 189
5.3.2 Design for High Performance 197

5.4 Good Convolutional Codes 201


5.4.1 Catastrophic Error Propagation 202
5.4.2 Some Known Good Convolutional Codes 202

5.5 Punctured Convolutional Codes 202

Problems 210
References 210
Selected Bibliography 212

6 Modern Codes 213

6.1 Turbo Codes 213


6.1.1 Code Concatenation 213
6.1.2 Concatenating Codes in Parallel: Turbo Code 218
6.1.3 Iterative Decoding of Turbo Codes 228
6.1.4 Implementing MAP 250

6.2 Low-Density Parity-Check Codes 252


6.2.1 Codes with Sparse Parity-Check Matrix 254
6.2.2 Decoding and Encoding Algorithms 259
6.2.3 High-Level Architecture Design for
LDPC Decoders 270

Problems 272
References 274
Selected Bibliography 276

About the Author 277

Index 279
Preface

This book attempts to provide a comprehensible and practical introduction


to error control coding. The targeted readers are practicing engineers and
university students who have already set foot in this territory or plan to. To
achieve the goal, this book takes an approach that is somewhat different from
the approaches used by the many excellent textbooks currently available.
First, the book introduces MATLAB as a tool to facilitate the pre-
sentation of key concepts. The DVD that accompanies this book provides
more than 90 MATLAB programs with which readers can experiment. It is
the author’s hope that this fresh attempt does help readers in mastering the
subject.
Second, the book pays attention to the implementation of various de-
coding algorithms. Readers will find that a few practical issues have received
in-depth treatment in the book, such as implementation of Galois field arith-
metic, Viterbi decoder design, RS decoder design, and MAP architecture, to
name a few.
The organization of the book is standard. Readers may notice, however,
that many mathematical proofs and theorems have been omitted. This is
because this book emphasizes concepts and rationales. For those who wish
to explore further, a comprehensive list of references is given at the end of
each chapter. Note that the MATLAB functions marked with asterisks are
provided by the book not by the MATLAB software.

ix
 A Practical Guide to Error-Control Coding Using MATLAB®

It is left to the readers to determine whether the book has served its
purpose. The author welcomes feedback of any kind (ecc.book.comments@
hotmail.com).
Finally the author would like to express his gratitude to editors Mark
Walsh, Lindsey Gendall, and Rebecca Allendorf at Artech House. With-
out their appreciation and help, publication of this book would have been
a lot harder. The author is also indebted to the book reviewer, who remains
anonymous to the author, for his valuable comments and suggestions, which
enlightened the author a great deal.
1
Error Control in Digital Communications
and Storage

The goal of this introductory chapter is to sketch out an overall picture of


error control coding for digital communications and storage, so that, after
completing the chapter, readers will have a rough idea of what the subject is
all about. The emphasis in this chapter is on the concepts and the rationale.

1.1 Error Control Coding at a Glance


1.1.1 Codes for Error Control

1.1.1.1 The Rationale


Digital communications and storage have become part of our daily lives. Ro­
bust data transmission and data storage are taken for granted. People hardly
realize that errors occur from time to time in data transmission/storage sys­
tems, and if it were not for the use of error control techniques, reliable data
transmission/storage would be impossible.
Errors in data transmission/storage systems can come from many differ­
ent sources: random noise, interference, channel fading, or physical defects,
just to name a few. These channel errors must be reduced to an accept­
able level to ensure the quality of data transmission/storage. To combat the


 A Practical Guide to Error-Control Coding Using MATLAB®

errors, we normally use two strategies, either stand-alone or combined. The


first one is the automatic repeat request (ARQ). An ARQ system attempts
to detect the presence of errors in the received data. If any errors are found,
the receiver notifies the transmitter of the existence of errors. The transmitter
then resends the data until they are correctly received.
The second strategy, known as the forward error correction (FEC), not
only detects but also corrects the errors, so that data retransmission can be
avoided. In many practical applications retransmission may be difficult or not
even feasible at all. For example, it is impossible for any receiver in a real-time
broadcasting system to request data to be resent. In this case, FEC is the only
viable solution.
Either way, error control codes (ECC) are used for detecting the pres­
ence of errors and correcting them. To intuitively explain the mechanism
of ECC, let us look at a simple example from our daily lives. You and your
friend are going for a walk. Before you leave, you recall that rain has been
forecast. So you say to your friend, “We should carry an umbrella with us.”
Your friend may hear it as “We should carry a banana with us” and gets
confused. However, if you instead say, “We should carry an umbrella with
us; it’s going to rain,” your friend will know what you said is umbrella not
banana, based on the context of your second sentence. Your second sentence
in this case is redundancy that facilitates detection and correction of the error.
ECC does exactly the same thing. It first adds redundancy to the message to
be sent; this process is called encoding and is carried out at the transmitter.
It then corrects errors based on the redundancy in a process called decoding
that is performed at the receiver. The output of the encoding process is a
codeword that contains both the message and the redundancy (explicitly or
implicitly). The redundancy is referred to as the parity check, or simply the
parity. Figure 1.1 shows a typical communications system equipped with er­
ror control functionality.

Example 1.1
We send a message bit of 1 to the receiver. Due to the channel error, when
the bit passes the channel and arrives at the receiver it becomes a 0. Unfor-
tunately there is no indication whatsoever whether the received bit is correct
or not.
Now, instead of sending the raw message bit, we send a codeword c formed
by repeating the message bit three times. The codeword corresponding to a
message bit of 0 is c0 = (000), and the codeword for a message bit of 1 is c1 =
(111). The redundancy here is the two duplicates of the message bit.
Error Control in Digital Communications and Storage 

Transmitter
Information
Encoding Modulation
source

Channel
Receiver
Information
Decoding Demodulation
destination

Figure 1.1 A typical communications system with ECC.

Suppose that the received word is r = (011), which has an error in its
first position. We immediately know that r is in error, because all three bits
are supposed to be identical but they are not.
Notice that r differs from c0 by two bits and differs from c1 by one bit. It
is logical to think that the received word is more likely to be r if c1 is sent.
So we can quite confidently conclude that the codeword transmitted is c1 =
(111) and the original message is 1. The two redundant bits have helped us
make correct decoding.
This trivial repetition code provides both error detection and error cor-
rection capability.

Figure 1.2 illustrates a typical bit error rate (BER) versus signal-to-noise
ratio (SNR) curve for coded and uncoded systems.
The use of error correction, however, is not free. The redundancy acts
as overhead and it “costs” transmission resources (e.g., channel bandwidth
or transmission power). Therefore, we want the redundancy to be as small
as possible. To give the redundancy a quantitative measure, the coding rate
R is defined as the ratio of the message length to the codeword length. For
example, if a coding scheme generates a codeword of length n from a message
of length k, the coding rate is:
R = kn (1.1)

The maximum value of the coding rate is 1 when no redundancy is


added (i.e., when the message is uncoded). Coding performance and cod­
ing rate are two opposing factors. As more redundancy is added, the error
 A Practical Guide to Error-Control Coding Using MATLAB®

−1
10

−2
10

Uncoded performance
BER

−3
10

−4 Coded performance
10

−5
10
3 4 5 6 7 8 9
SNR (dB)

Figure 1.2 Typical BER performance of coded system.

correction capability is strengthened, but the coding rate drops. A good code
should maximize the error correction performance while keeping the coding
rate close to 1.

1.1.1.2 A Second Look at ECC


From the preceding introduction, it seems that we are definitely better off
using error control coding because errors indeed get corrected (as seen in the
example). A closer examination of the coding principle, however, shows that
this may not be always true, despite the error correction capability provided.
As we have just said, the redundancy costs resources. To see if coding is really
beneficial, we need to compare coded systems and uncoded systems under the
condition of equal resource usage.
Now, say, we use 1 watt of power to transmit the raw message bit in the
preceding example. With coding, the transmit power of each bit in the code­
word is reduced to 1/3 watt (the total power is kept to 1 watt). Consequently,
the probability of errors will increase. We see, on one hand, that coding cor­
Error Control in Digital Communications and Storage 

rects channel errors and brings down the error probability; on the other hand,
reduced power per bit causes the error probability to go higher. So we will be
better off only if the coding increases the performance enough to make up
for the signal power reduction caused by the redundancy and produces a net
gain. Let us reexamine Figure 1.2. We observe that the BER performance of
the coded system is actually worse than that of the coded system in the low
SNR range (£3.5 dB in the figure). This is because the coding in that SNR
range is not able to offer enough performance improvement to cover the sig­
nal power loss due to the redundancy.
As a conclusion, codes must be designed to offer a net performance
gain.

1.1.2 Important Concepts

1.1.2.1 Types of Codes


Depending on how redundancy is added, there are two families of codes.
One is called the block codes. Block coding encodes and decodes data on
a block-by-block basis. Data blocks in this case are independent from each
other. Consequently block coding is a memoryless operation and can be im­
plemented using combinational logic. The code in Example 1.1 is a block
code because the coding is completely determined by the current data block.
In contrast, another family of codes, namely, the convolutional codes, works
on a continuous data stream, and its encoding and decoding operations de­
pend not only on the current data but also on the previous data. As such,
convolutional coding contains memory and has to be implemented using
sequential logic.

1.1.2.2 Systematic Versus Nonsystematic Codes


A complete codeword comprises the message and the redundancy. If the re­
dundancy is implicitly embedded in the codeword, the code is said to be
nonsystematic. On the other hand, if the redundancy is explicitly appended
to the message, the code is systematic (see Figure 1.3). Systematic codes are
always preferred in practice, because the message and the parity are separated
so the receiver can directly extract the message from the decoded codeword.

1.1.2.3 Digital Modulation


After error control encoding, we have a sequence of coded digital symbols,
which is to be converted to an analog signal (called the carrier) before it can
be transmitted over a physical channel (copper wire, optical fiber, or air).
 A Practical Guide to Error-Control Coding Using MATLAB®

Figure 1.3 Structure of systematic code.

This job is done by modulation. According to the symbols, the modulation


process instantaneously alters the amplitude, phase, frequency (or a combina­
tion thereof ) of the carrier to convey the information to be transmitted. A
modulation scheme of particular interest is binary phase shift keying (BPSK)
for binary symbols (i.e., bits). BPSK assigns to the carrier 0 phase shift when
the bit is a 0, and p phase shift when the bit is a 1. From a baseband point
of view, the BPSK modulation is a mapping process: 0 ® 1 and 1 ® –1.
Figure 1.4 shows the waveform of a BPSK modulated signal. At the receiver,
the received signal is demodulated back to digital symbols.

Figure 1.4 BPSK modulated signal.


Error Control in Digital Communications and Storage 

Extending BPSK to the nonbinary case, let us say that the symbol
consists of two bits. Then the symbol has four possible combinations: (00),
(01), (11), and (10). Assigning to the carrier four corresponding phase shifts
p/4, 3p/4, 5p/4, and 7p/4, we form so-called quadrature phase-shift keying
(QPSK). QPSK maps the symbol as (00) ® 1 + j, (01) ® -1 + j, (11) ® -1 -
j, (10) ® 1 - j. The signal space constellations of BPSK and QPSK are de­
picted in Figure 1.5.

MATLAB Experiment 1.1


The Communications Toolbox in MATLAB provides a pair of func­tions,
modmap and demodmap, to map a digital signal to and from an analog signal
for a given modulation scheme, respectively. Typing in modmap(‘psk’,2)
and modmap(‘psk’,4) generate the BPSK and QPSK constellations, as
shown in Figure 1.5.

BPSK

(1) (0)

−1 +1

QPSK
Q
+1
(01) (00)

I
−1 +1

(11) (01)
−1

Figure 1.5 Signal constellation of BPSK and QPSK.


 A Practical Guide to Error-Control Coding Using MATLAB®

1.1.2.4 Channel and Channel Errors


The most common transmission errors are caused by additive white Gauss­
ian noise (AWGN). Because this type of noise is totally random, the AWGN
errors are independent from each other; that is, they are memoryless. Such a
transmission channel is called an AWGN channel. Most error control codes
tackle memoryless errors.
However, in some scenarios channel errors occur in bursts. The bursty
channel involves memory, therefore the errors are correlated. Wireless fading
channels and defects on the surface of a compact disc are two examples of the
channel.
Classical coding theory often views the modulation, channel, and de­
modulation in Figure 1.2 as being combined as a discrete composite channel.
The input to the composite channel consists of binary bits. If the demodulation
also outputs binary bits, we may neglect all details inside the composite channel
and simply model it as a binary symmetric channel (BSC) (see Figure 1.6) char­
acterized by the crossover probability px. The crossover probability is defined
as the probability of a bit error. For the particular case of AWGN “internal”
channel and BPSK signaling, px can be computed as follows:

æ ö
px = Q ç 2 Eb N ÷ (1.2)
è 0ø


( 2p ) ∫x
y 2 /2
where Q ( x ) � 1 ⋅ e dy is called the Q -function and Eb/N0 is
the bit SNR. Like an AWGN channel, the BSC is also memoryless.

MATLAB Experiment 1.2


The AWGN channel is modeled in MATLAB by awgn. The function
adds AWGN noise to transmitted data at a specified SNR.
The companion DVD provides a BSC model bsc*, which introduces
random bit errors to a binary sequence based on a crossover probability.

. Eb denotes the bit energy, and N0 denotes the AWGN power spectral density.
Error Control in Digital Communications and Storage 

Transmit Receive
1− px
0 0

px Crossover
px probability

1− px
1 1

Figure 1.6 Binary symmetric channel.

MATLAB Experiment 1.3

The DVD also includes a simple script qfunc* to compute the Q-func­
tion. To calculate the crossover probability at Eb/N0 = 0 dB, we type in the
following command:
>> eb_n0 = 0; % dB
>> eb_n0 = 10^(eb_n0/10); % convert to linear scale
>> px = qfunc(sqrt(2*eb_n0)) % crossover prob.
px =
0.0786

1.1.2.5 Optimal Decoding Principles


Recall that in the previous example, we take c1 as the decoded output, because
the received vector is more likely to be r if c1 is sent. Decoding based on this
principle is called maximum-likelihood decoding, or simply ML decoding.
Mathematically ML decoding can be expressed as follows:

ìc0 , if P (r | c0 ) ³ P (r | c1 )
c� = í (1.3)
î c1, if P (r | c0 ) < P (r | c1 )

where c˜ denotes the decoded word and P(r |c0) [or P(r |c1)] is the prob­
ability that the word r is received given the condition that the codeword

. For the sake of simplicity, we assume two codewords in total. The principle remains the
same for cases with more codewords.
10 A Practical Guide to Error-Control Coding Using MATLAB®

c0 (or c1) is transmitted. ML decoding is optimal if all codewords (or


message symbols, since they have one-to-one correspondence) are equally
likely.
When the occurrences of the codewords are not equally probable, so-
called maximum a posteriori decoding, or MAP decoding, comes into play.
In contrast to ML, MAP selects as the decoded output the codeword that
maximizes the a posteriori probability (APP):

ìc0 , if P (c0 | r ) ³ P (c1 | r )


c� = í (1.4)
î c1, if P (c0 | r ) < P (c1 | r )

where P(c0|r) [or P(c1|r)] is the probability that c0 (or c1) is transmitted given
the condition that the vector r is received.
In the previous example, we implied that the codewords c0 and c1 are
equally likely to occur. If, say, c0 has an 80% chance to be sent, and c1 has the
remaining 20%, then we need to use MAP to achieve optimal decoding.
When all message symbols are equally probable, ML and MAP decod­
ing techniques are equivalent.

1.1.2.6 Hard-Decision Decoding and Soft-Decision Decoding


With BSC, the input to the decoder is a binary sequence. Decoding based on
“hard” binary bits is referred to as hard-decision decoding. In contrast, if the
demodulation process uses a multilevel “soft” value to represent an output
bit, the decoding then works on (quantized) real values. This type of decod­
ing is called soft-decision decoding. Hard-decision decoding can be viewed
as a special case of soft decoding in which single-bit quantization is used. We
can imagine that soft-decision decoding performs better because it has more
information to exploit.

1.1.2.7 Minimum Hamming Distance and Error Correction Capability


In Example 1.1, we chose as decoded output the codeword to which the re­
ceived word is “closest” in distance. The distance was measured by counting
the number of differing bits in two words. This distance, denoted by dH and
referred to as the Hamming distance, is frequently used in coding theory. As­
sociated with the Hamming distance is the so-called Hamming weight wH,
which is defined as the Hamming distance between a nonzero codeword and
the all-zero codeword. For a binary word, the Hamming weight is simply the
number of 1s in the word.
Let c1 and c2 be any two codewords of a linear code C. The Hamming
distance and the Hamming weight have the following relation:
Error Control in Digital Communications and Storage 11

d H (c1, c2 ) = wH (c1 + c2 ) (1.5)

It is now clear that the decoding performed in the previous example is


actually a process to choose a codeword c˜ that satisfies the following:

c� = arg min d H (r , c ) (1.6)


c ÎC

For a BSC channel, (1.6) represents ML decoding [1].


The smallest Hamming distance dmin between any two different code­
words ci and cj in a code C is called the minimum Hamming distance of the
code, that is:

d min = min d H (ci , c j ) (1.7)

where dmin reflects the error correction capability of a code. To explain this,
let us assume that C is a code with a total of eight codewords c0, c1, ... , c7,
which are graphically represented as eight points in Figure 1.7. Without
loss of generality, we also assume dH(c1, c3) = dmin. Now we draw a circle
around each codeword point with the same radius and no overlap with the
others. Evidently the maximum such radius is t = ë(dmin - 1)/2û, where ëxû

C C

C C

Figure 1.7 Graphical representation of decoding sphere.


12 A Practical Guide to Error-Control Coding Using MATLAB®

denotes the greatest integer no greater than x. These circles are called the
Hamming sphere (or the decoding sphere) of their corresponding codewords.
Now suppose that we send c3 to the receiver. If no channel errors exist, the
received word r will coincide with the codeword point c3 in the figure. Oth­
erwise the channel errors will move r away from where c3 is. If in this case
r falls within the Hamming sphere of c3, r will still be correctly decoded to
c3, simply because it is closer to c3 than any other codeword point (the ML
decoding criterion). If r falls out of the sphere, then it will be mistakenly
decoded to some other codeword. From this we actually can draw a general
conclusion:

Correct decoding is guaranteed if and only if the received word falls within
the Hamming sphere of the true codeword.

In other words, the maximum error correction capability of a code quals to


the radius of the Hamming sphere t. Therefore,

t = ë(dmin - 1)/2û (1.8)

is the random error correction capability of the code.

Example 1.2
The repetition code in the previous example contains only two codewords,
c0 = (000) and c1 = (111). Therefore, the Hamming distance between the
two codewords is the minimum Hamming distance, which is computed to
be:
d min = d H (c0 , c1 ) = 1 + 1 + 1 = 3

Based on (1.8), we see that the code is able to correct, at most, one ran-
dom error. Example 1.1 confirms that it does correct one error. It is also easy
to verify that the code cannot correct two or more errors. For instance, if c1
is transmitted and r = (001) (containing two errors) is received, r will be
incorrectly decoded to c0.

1.1.2.8 Performance Measures


The most direct measure of performance of an error correcting system is
the error rate, defined as the number of errors that the decoder fails to
correct divided by the length of the transmitted sequence, at a specified
SNR.
Error Control in Digital Communications and Storage 13

However, in many practical applications, exact computation of the er­


ror rate is difficult. It is more convenient to use the union bound instead. The
union bound is an upper bound and it is computed based on the following
observation: If an event is the union of n subevents E1, E2, ... , En, then the
probability of the event occurring, P(E1  E2  ... En), is at most the sum of
the probabilities of all the subevents, P(Ei) (1 £ i £ n), that is:

P ( E1 ∪ E 2 ∪ ⋅ ⋅ ⋅ ∪ En ) ≤ P ( E1 ) + P ( E 2 ) + ⋅ ⋅ ⋅ + P ( En ) (1.9)

where the equality holds when the subevents are mutually exclusive.
Alternatively an error control system may also be evaluated with cod­
ing gain. Coding gain measures the difference in the SNR levels between the
coded system and uncoded system at a specified error rate. Go back to Figure
1.2; the difference in Eb /N0 between the intersections of the two BER curves
and the horizontal line of 10-4 is the coding gain of the code at the error rate
of 10–4. While the coding gain must be evaluated for each individual code
of interest, the asymptotic coding gain, an approximation to the coding gain
when SNR >> 1, offers a simple and quick measure of the coding perfor­
mance. It has been shown that, for hard-decision decoding, a code with a
rate R and a minimum distance dmin has an asymptotic coding gain of [1, 2]:

(
K = 10 × log Rd min 2 ) (1.10)

For soft-decision decoding, the asymptotic coding gain becomes:

K = 10 × log (Rd min ) (1.11)

which is 3 dB better.

MATLAB Experiment 1.4


The MATLAB function cgain* estimates the coding gain given the
error probability of the code. Let us find the coding gain at a BER of 10–4 for
the code in Figure 1.2.
>> % bit snr in dB
>> eb_n0 = [3.25 4 5 6 7 7.5];
>> % bit error probability of the code corresponding to eb_n0
>> ber = [2.8e-2 1e-2 2.05e-3 4e-4 4e-5 1e-5];
14 A Practical Guide to Error-Control Coding Using MATLAB®

>> cgain(eb_n0,ber,10^(-4))
ans =
1.7112
Comment: the result is in dB.

1.2 Channel Capacity and Shannon’s Theorem


Now we have some idea about the benefits that channel coding can provide.
It will be interesting to see the theoretic limit of the coding performance,
that is, how small the probability of error can go with a code of rate R.
The question was answered by Shannon in his landmark paper published
in 1948 [3]. In that paper Shannon proved the following channel coding
theorem:

By employing a sufficiently long error correction code, an arbitrarily small


probability of error can be achieved if the coded bits are transmitted at a rate less
than the channel capacity.

The channel capacity C, defined as the maximum number of bits per unit
time that can be transmitted free of error over a channel, is given by the
Shannon formula:

(
C = B × log 2 1 + S N ) (1.12)

where B is the channel bandwidth, S/N = Eb RT /N0B is the average SNR


expressed in linear scale, and RT denotes the bit transmission rate. The value
of C is given in bits per second. Shannon’s channel coding theorem basi­
cally states that no such error correction codes exist to guarantee free-of-error
transmission if the information bits are transmitted at the rate RT > C; such
codes do, however, exist if RT £ C.

MATLAB Experiment 1.5


The MATLAB script chcap.m* plots the relation between the normal­
ized channel capacity C/B and the bit SNR shown in Figure 1.8.
Another Random Document on
Scribd Without Any Related Topics
heated my imagination to such a state of activity and ebullition, that
upon every occasion it fumed away in bursts of wit, and
evaporations of gaiety. I became on a sudden the idol of the coffee-
house, was in one winter solicited to accept the presidentship of five
clubs, was dragged by violence to every new play, and quoted in
every controversy upon theatrical merit; was in every publick place
surrounded by a multitude of humble auditors, who retailed in other
places of resort my maxims and my jests, and was boasted as their
intimate and companion, by many, who had no other pretensions to
my acquaintance, than that they had drank chocolate in the same
room.
You will not wonder, Mr. Rambler, that I mention my success with
some appearance of triumph and elevation. Perhaps no kind of
superiority is more flattering or alluring than that which is conferred
by the powers of conversation, by extemporaneous sprightliness of
fancy, copiousness of language, and fertility of sentiment. In other
exertions of genius, the greater part of the praise is unknown and
unenjoyed; the writer, indeed, spreads his reputation to a wider
extent, but receives little pleasure or advantage from the diffusion of
his name, and only obtains a kind of nominal sovereignty over
regions which pay no tribute. The colloquial wit has always his own
radiance reflected on himself, and enjoys all the pleasure which he
bestows; he finds his power confessed by every one that approaches
him, sees friendship kindling with rapture, and attention swelling into
praise.
The desire which every man feels of importance and esteem, is so
much gratified by finding an assembly, at his entrance, brightened
with gladness and hushed with expectation, that the recollection of
such distinctions can scarcely fail to be pleasing whensoever it is
innocent. And my conscience does not reproach me with any mean
or criminal effects of vanity; since I always employed my influence
on the side of virtue, and never sacrificed my understanding or my
religion to the pleasure of applause.
There were many whom either the desire of enjoying my
pleasantry, or the pride of being thought to enjoy it, brought often
into my company; but I was caressed in a particular manner by
Demochares, a gentleman of a large estate, and a liberal disposition.
My fortune being by no means exuberant, inclined me to be pleased
with a friend who was willing to be entertained at his own charge. I
became by daily invitations habituated to his table, and, as he
believed my acquaintance necessary to the character of elegance,
which he was desirous of establishing, I lived in all the luxury of
affluence, without expense or dependence, and passed my life in a
perpetual reciprocation of pleasure, with men brought together by
similitude of accomplishments, or desire of improvement.
But all power has its sphere of activity, beyond which it produces
no effect. Demochares, being called by his affairs into the country,
imagined that he should increase his popularity by coming among
his neighbours accompanied by a man whose abilities were so
generally allowed. The report presently spread through half the
country that Demochares was arrived, and had brought with him the
celebrated Hilarius, by whom such merriment would be excited, as
had never been enjoyed or conceived before. I knew, indeed, the
purpose for which I was invited, and, as men do not look diligently
out for possible miscarriages, was pleased to find myself courted
upon principles of interest, and considered as capable of reconciling
factions, composing feuds, and uniting a whole province in social
happiness.
After a few days spent in adjusting his domestick regulations,
Demochares invited all the gentlemen of his neighbourhood to
dinner, and did not forget to hint how much my presence was
expected to heighten the pleasure of the feast. He informed me
what prejudices my reputation had raised in my favour, and
represented the satisfaction with which he should see me kindle up
the blaze of merriment, and should remark the various effects that
my fire would have upon such diversity of matter.
This declaration, by which he intended to quicken my vivacity,
filled me with solicitude. I felt an ambition of shining which I never
knew before; and was therefore embarrassed with an unusual fear
of disgrace. I passed the night in planning out to myself the
conversation of the coming day; recollected all my topicks of raillery,
proposed proper subjects of ridicule, prepared smart replies to a
thousand questions, accommodated answers to imaginary repartees,
and formed a magazine of remarks, apophthegms, tales, and
illustrations.
The morning broke at last in the midst of these busy meditations.
I rose with the palpitations of a champion on the day of combat;
and, notwithstanding all my efforts, found my spirits sunk under the
weight of expectation. The company soon after began to drop in,
and every one, at his entrance, was introduced to Hilarius. What
conception the inhabitants of this region had formed of a wit, I
cannot yet discover; but observed that they all seemed, after the
regular exchange of compliments, to turn away disappointed; and
that while we waited for dinner, they cast their eyes first upon me,
and then upon each other, like a theatrical assembly waiting for a
show.
From the uneasiness of this situation, I was relieved by the
dinner; and as every attention was taken up by the business of the
hour, I sunk quietly to a level with the rest of the company. But no
sooner were the dishes removed, than, instead of cheerful
confidence and familiar prattle, an universal silence again shewed
their expectation of some unusual performance. My friend
endeavoured to rouse them by healths and questions, but they
answered him with great brevity, and immediately relapsed into their
former taciturnity.
I had waited in hope of some opportunity to divert them, but
could find no pass opened for a single sally; and who can be merry
without an object of mirth? After a few faint efforts, which produced
neither applause nor opposition, I was content to mingle with the
mass, to put round the glass in silence, and solace myself with my
own contemplations.
My friend looked round him; the guests stared at one another;
and if now and then a few syllables were uttered with timidity and
hesitation, there was none ready to make any reply. All our faculties
were frozen, and every minute took away from our capacity of
pleasing, and disposition to be pleased. Thus passed the hours to
which so much happiness was decreed; the hours which had, by a
kind of open proclamation, been devoted to wit, to mirth, and to
Hilarius.
At last the night came on, and the necessity of parting freed us
from the persecutions of each other. I heard them, as they walked
along the court, murmuring at the loss of the day, and inquiring
whether any man would pay a second visit to a house haunted by a
wit.
Demochares, whose benevolence is greater than his penetration,
having flattered his hopes with the secondary honour which he was
to gain by my sprightliness and elegance, and the affection with
which he should be followed for a perpetual banquet of gaiety, was
not able to conceal his vexation and resentment, nor would easily be
convinced, that I had not sacrificed his interest to sullenness and
caprice, and studiously endeavoured to disgust his guests, and
suppressed my powers of delighting, in obstinate and premeditated
silence. I am informed that the reproach of their ill reception is
divided by the gentlemen of the country between us; some being of
opinion that my friend is deluded by an impostor, who, though he
has found some art of gaining his favour, is afraid to speak before
men of more penetration; and others concluding that I think only
London the proper theatre of my abilities, and disdain to exert my
genius for the praise of rusticks.
I believe, Mr. Rambler, that it has sometimes happened to others,
who have the good or ill fortune to be celebrated for wits, to fall
under the same censures upon the like occasions. I hope therefore
that you will prevent any misrepresentations of such failures, by
remarking that invention is not wholly at the command of its
possessor; that the power of pleasing is very often obstructed by the
desire; that all expectation lessens surprise, yet some surprise is
necessary to gaiety; and that those who desire to partake of the
pleasure of wit must contribute to its production, since the mind
stagnates without external ventilation, and that effervescence of the
fancy, which flashes into transport, can be raised only by the infusion
of dissimilar ideas.
No. 102.
SATURDAY, MARCH 9, 1751.

Ipsa quoque assiduo labuntur tempora motu,


Non secus ac flumen. Neque enim consistere
flumen,
Nec levis hora potest: sed ut unda impellitur unda,
Urgeturque prior veniente, urgetque priorem,
Tempora sic fugiunt pariter, pariterque sequuntur.

Ovid, Met. xv. 179.

With constant motion as the moments glide.


Behold in running life the rolling tide!
For none can stem by art, or stop by pow'r,
The flowing ocean, or the fleeting hour:
But wave by wave pursued arrives on shore,
And each impell'd behind impels before:
So time on time revolving we descry;
So minutes follow, and so minutes fly.

Elphinston.

"Life," says Seneca, "is a voyage, in the progress of which we are


perpetually changing our scenes: we first leave childhood behind us,
then youth, then the years of ripened manhood, then the better and
more pleasing part of old age." The perusal of this passage having
incited in me a train of reflections on the state of man, the incessant
fluctuation of his wishes, the gradual change of his disposition to all
external objects, and the thoughtlessness with which he floats along
the stream of time, I sunk into a slumber amidst my meditations,
and on a sudden, found my ears filled with the tumult of labour, the
shouts of alacrity, the shrieks of alarm, the whistle of winds, and the
dash of waters.
My astonishment for a time repressed my curiosity; but soon
recovering myself so far as to inquire whither we were going, and
what was the cause of such clamour and confusion, I was told that
we were launching out into the ocean of life; that we had already
passed the streights of infancy, in which multitudes had perished,
some by the weakness and fragility of their vessels, and more by the
folly, perverseness, or negligence, of those who undertook to steer
them; and that we were now on the main sea, abandoned to the
winds and billows, without any other means of security than the care
of the pilot, whom it was always in our power to choose among
great numbers that offered their direction and assistance.
I then looked round with anxious eagerness; and first turning my
eyes behind me, saw a stream flowing through flowery islands,
which every one that sailed along seemed to behold with pleasure;
but no sooner touched, than the current, which, though not noisy or
turbulent, was yet irresistible, bore him away. Beyond these islands
all was darkness, nor could any of the passengers describe the shore
at which he first embarked.
Before me, and on each side, was an expanse of waters violently
agitated, and covered with so thick a mist, that the most
perspicacious eye could see but a little way. It appeared to be full of
rocks and whirlpools, for many sunk unexpectedly while they were
courting the gale with full sails, and insulting those whom they had
left behind. So numerous, indeed, were the dangers, and so thick
the darkness, that no caution could confer security. Yet there were
many, who, by false intelligence, betrayed their followers into
whirlpools, or by violence pushed those whom they found in their
way against the rocks.
The current was invariable and insurmountable; but though it was
impossible to sail against it, or to return to the place that was once
passed, yet it was not so violent as to allow no opportunities for
dexterity or courage, since, though none could retreat back from
danger, yet they might often avoid it by oblique direction.
It was, however, not very common to steer with much care or
prudence; for by some universal infatuation, every man appeared to
think himself safe, though he saw his consorts every moment sinking
round him; and no sooner had the waves closed over them, than
their fate and their misconduct were forgotten; the voyage was
pursued with the same jocund confidence; every man congratulated
himself upon the soundness of his vessel, and believed himself able
to stem the whirlpool in which his friend was swallowed, or glide
over the rocks on which he was dashed: nor was it often observed
that the sight of a wreck made any man change his course: if he
turned aside for a moment, he soon forgot the rudder, and left
himself again to the disposal of chance.
This negligence did not proceed from indifference, or from
weariness of their present condition; for not one of those who thus
rushed upon destruction, failed, when he was sinking, to call loudly
upon his associates for that help which could not now be given him;
and many spent their last moments in cautioning others against the
folly by which they were intercepted in the midst of their course.
Their benevolence was sometimes praised, but their admonitions
were unregarded.
The vessels in which we had embarked being confessedly unequal
to the turbulence of the stream of life, were visibly impaired in the
course of the voyage; so that every passenger was certain, that how
long soever he might, by favourable accidents, or by incessant
vigilance, be preserved, he must sink at last.
This necessity of perishing might have been expected to sadden
the gay, and intimidate the daring, at least to keep the melancholy
and timorous in perpetual torments, and hinder them from any
enjoyment of the varieties and gratifications which nature offered
them as the solace of their labours; yet, in effect, none seemed less
to expect destruction than those to whom it was most dreadful; they
all had the art of concealing their danger from themselves; and
those who knew their inability to bear the sight of the terrours that
embarrassed their way, took care never to look forward, but found
some amusement for the present moment, and generally
entertained themselves by playing with Hope, who was the constant
associate of the voyage of life.
Yet all that Hope ventured to promise, even to those whom she
favoured most, was not that they should escape, but that they
should sink last; and with this promise every one was satisfied,
though he laughed at the rest for seeming to believe it. Hope,
indeed, apparently mocked the credulity of her companions; for, in
proportion as their vessels grew leaky, she redoubled her assurances
of safety; and none were more busy in making provisions for a long
voyage, than they whom all but themselves saw likely to perish soon
by irreparable decay.
In the midst of the current of life was the gulph of Intemperance,
a dreadful whirlpool, interspersed with rocks, of which the pointed
crags were concealed under water, and the tops covered with
herbage, on which Ease spread couches of repose, and with shades,
where Pleasure warbled the song of invitation. Within sight of these
rocks all who sailed on the ocean of life must necessarily pass.
Reason, indeed, was always at hand to steer the passengers through
a narrow outlet by which they might escape; but very few could, by
her entreaties or remonstrances, be induced to put the rudder into
her hand, without stipulating that she should approach so near unto
the rocks of Pleasure, that they might solace themselves with a short
enjoyment of that delicious region, after which they always
determined to pursue their course without any other deviation.
Reason was too often prevailed upon so far by these promises, as
to venture her charge within the eddy of the gulph of Intemperance,
where, indeed, the circumvolution was weak, but yet interrupted the
course of the vessel, and drew it, by insensible rotations, towards
the centre. She then repented her temerity, and with all her force
endeavoured to retreat; but the draught of the gulph was generally
too strong to be overcome; and the passenger, having danced in
circles with a pleasing and giddy velocity, was at last overwhelmed
and lost. Those few whom Reason was able to extricate, generally
suffered so many shocks upon the points which shot out from the
rocks of Pleasure, that they were unable to continue their course
with the same strength and facility as before, but floated along
timorously and feeble, endangered by every breeze, and shattered
by every ruffle of the water, till they sunk, by slow degrees, after
long struggles, and innumerable expedients, always repining at their
own folly, and warning others against the first approach of the gulph
of Intemperance.
There were artists who professed to repair the breaches and stop
the leaks of the vessels which had been shattered on the rocks of
Pleasure. Many appeared to have great confidence in their skill, and
some, indeed, were preserved by it from sinking, who had received
only a single blow; but I remarked that few vessels lasted long
which had been much repaired, nor was it found that the artists
themselves continued afloat longer than those who had least of their
assistance.
The only advantage which, in the voyage of life, the cautious had
above the negligent, was, that they sunk later, and more suddenly;
for they passed forward till they had sometimes seen all those in
whose company they had issued from the streights in infancy, perish
in the way, and at last were overset by a cross breeze, without the
toil of resistance, or the anguish of expectation. But such as had
often fallen against the rocks of Pleasure, commonly subsided by
sensible degrees, contended long with the encroaching waters, and
harassed themselves by labours that scarce Hope herself could
flatter with success.
As I was looking upon the various fate of the multitude about me,
I was suddenly alarmed with an admonition from some unknown
Power, "Gaze not idly upon others when thou thyself art sinking.
Whence is this thoughtless tranquillity, when thou and they are
equally endangered?" I looked, and seeing the gulph of
Intemperance before me, started and awaked.
No. 103.
TUESDAY, MARCH 12, 1751.

Scire volunt secreta domus atque inde timeri.

Juv. Sat. iii, 113.

They search the secrets of the house, and so


Are worshipp'd there, and fear'd for what they
know.

Dryden.

Curiosity is one of the permanent and certain characteristicks of a


vigorous intellect. Every advance into knowledge opens new
prospects, and produces new incitements to further progress. All the
attainments possible in our present state are evidently inadequate to
our capacities of enjoyment; conquest serves no purpose but that of
kindling ambition, discovery has no effect but of raising expectation;
the gratification of one desire encourages another; and after all our
labours, studies, and inquiries, we are continually at the same
distance from the completion of our schemes, have still some wish
importunate to be satisfied, and some faculty restless and turbulent
for want of its enjoyment.
The desire of knowledge, though often animated by extrinsick and
adventitious motives, seems on many occasions to operate without
subordination to any other principle; we are eager to see and hear,
without intention of referring our observations to a farther end; we
climb a mountain for a prospect of the plain; we run to the strand in
a storm, that we may contemplate the agitation of the water; we
range from city to city, though we profess neither architecture nor
fortification; we cross seas only to view nature in nakedness, or
magnificence in ruins; we are equally allured by novelty of every
kind, by a desert or a palace, a cataract or a cavern, by every thing
rude and every thing polished, every thing great and every thing
little; we do not see a thicket but with some temptation to enter it,
nor remark an insect flying before us but with an inclination to
pursue it.
This passion is, perhaps, regularly heightened in proportion as the
powers of the mind are elevated and enlarged. Lucan therefore
introduces Cæsar speaking with dignity suitable to the grandeur of
his designs and the extent of his capacity, when he declares to the
high-priest of Egypt, that he has no desire equally powerful with that
of finding the origin of the Nile, and that he would quit all the
projects of the civil war for a sight of those fountains which had
been so long concealed. And Homer, when he would furnish the
Sirens with a temptation, to which his hero, renowned for wisdom,
might yield without disgrace, makes them declare, that none ever
departed from them but with increase of knowledge.
There is, indeed, scarce any kind of ideal acquirement which may
not be applied to some use, or which may not at least gratify pride
with occasional superiority; but whoever attends the motions of his
own mind will find, that upon the first appearance of an object, or
the first start of a question, his inclination to a nearer view, or more
accurate discussion, precedes all thoughts of profit, or of
competition; and that his desires take wing by instantaneous
impulse, though their flight may be invigorated, or their efforts
renewed, by subsequent considerations. The gratification of curiosity
rather frees us from uneasiness than confers pleasure; we are more
pained by ignorance, than delighted by instruction. Curiosity is the
thirst of the soul; it inflames and torments us, and makes us taste
every thing with joy, however otherwise insipid, by which it may be
quenched.
It is evident that the earliest searchers after knowledge must have
proposed knowledge only as their reward; and that science, though
perhaps the nursling of interest, was the daughter of curiosity: for
who can believe that they who first watched the course of the stars,
foresaw the use of their discoveries to the facilitation of commerce,
or the mensuration of time? They were delighted with the splendour
of the nocturnal skies, they found that the lights changed their
places; what they admired they were anxious to understand, and in
time traced their revolutions.
There are, indeed, beings in the form of men, who appear
satisfied with their intellectual possessions, and seem to live without
desire of enlarging their conceptions; before whom the world passes
without notice, and who are equally unmoved by nature or by art.
This negligence is sometimes only the temporary effect of a
predominant passion: a lover finds no inclination to travel any path,
but that which leads to the habitation of his mistress; a trader can
spare little attention to common occurrences, when his fortune is
endangered by a storm. It is frequently the consequence of a total
immersion in sensuality; corporeal pleasures may be indulged till the
memory of every other kind of happiness is obliterated; the mind,
long habituated to a lethargick and quiescent state, is unwilling to
wake to the toil of thinking; and though she may sometimes be
disturbed by the obtrusion of new ideas, shrinks back again to
ignorance and rest.
But, indeed, if we except them to whom the continual task of
procuring the supports of life, denies all opportunities of deviation
from their own narrow track, the number of such as live without the
ardour of inquiry is very small, though many content themselves
with cheap amusements, and waste their lives in researches of no
importance.
There is no snare more dangerous to busy and excursive minds,
than the cobwebs of petty inquisitiveness, which entangle them in
trivial employments and minute studies, and detain them in a middle
state, between the tediousness of total inactivity, and the fatigue of
laborious efforts, enchant them at once with ease and novelty, and
vitiate them with the luxury of learning. The necessity of doing
something, and the fear of undertaking much, sinks the historian to
a genealogist, the philosopher to a journalist of the weather, and the
mathematician to a constructor of dials.
It is happy when those who cannot content themselves to be idle,
nor resolve to be industrious, are at least employed without injury to
others; but it seldom happens that we can contain ourselves long in
a neutral state, or forbear to sink into vice, when we are no longer
soaring towards virtue.
Nugaculus was distinguished in his earlier years by an uncommon
liveliness of imagination, quickness of sagacity, and extent of
knowledge. When he entered into life, he applied himself with
particular inquisitiveness to examine the various motives of human
actions, the complicated influence of mingled affections, the
different modifications of interest and ambition, and the various
causes of miscarriage and success both in public and private affairs.
Though his friends did not discover to what purpose all these
observations were collected, or how Nugaculus would much improve
his virtue or his fortune by an incessant attention to changes of
countenance, bursts of inconsideration, sallies of passion, and all the
other casualties by which he used to trace a character, yet they
could not deny the study of human nature to be worthy of a wise
man; they therefore flattered his vanity, applauded his discoveries,
and listened with submissive modesty to his lectures on the
uncertainty of inclination, the weakness of resolves, and the
instability of temper, to his account of the various motives which
agitate the mind, and his ridicule of the modern dream of a ruling
passion.
Such was the first incitement of Nugaculus to a close inspection
into the conduct of mankind. He had no interest in view, and
therefore no design of supplantation; he had no malevolence, and
therefore detected faults without any intention to expose them; but
having once found the art of engaging his attention upon others, he
had no inclination to call it back to himself, but has passed his time
in keeping a watchful eye upon every rising character, and lived
upon a small estate without any thought of increasing it.
He is, by continual application, become a general master of secret
history, and can give an account of the intrigues, private marriages,
competitions, and stratagems, of half a century. He knows the
mortgages upon every man's estate, the terms upon which every
spendthrift raises his money, the real and reputed fortune of every
lady, the jointure stipulated by every contract, and the expectations
of every family from maiden aunts and childless acquaintances. He
can relate the economy of every house, knows how much one man's
cellar is robbed by his butler, and the land of another underlet by his
steward; he can tell where the manor-house is falling, though large
sums are yearly paid for repairs; and where the tenants are felling
woods without the consent of the owner.
To obtain all this intelligence he is inadvertently guilty of a
thousand acts of treachery. He sees no man's servant without
draining him of his trust; he enters no family without flattering the
children into discoveries; he is a perpetual spy upon the doors of his
neighbours; and knows by long experience, at whatever distance,
the looks of a creditor, a borrower, a lover, and a pimp.
Nugaculus is not ill-natured, and therefore his industry has not
hitherto been very mischievous to others, or dangerous to himself:
but since he cannot enjoy this knowledge but by discovering it, and,
if he had no other motive to loquacity, is obliged to traffick like the
chymists, and purchase one secret with another, he is every day
more hated as he is more known; for he is considered by great
numbers as one that has their fame and their happiness in his
power, and no man can much love him of whom he lives in fear.
Thus has an intention, innocent at first, if not laudable, the
intention of regulating his own behaviour by the experience of
others, by an accidental declension of minuteness, betrayed
Nugaculus, not only to a foolish, but vicious waste of a life which
might have been honourably passed in publick services, or domestick
virtues. He has lost his original intention, and given up his mind to
employments that engross, but do not improve it.
No. 104.
SATURDAY, MARCH 16, 1751.

——Nihil est, quod credere de se


Non possit.——

Juv. Sat. iv. 70.

None e'er rejects hyperboles of praise.

The apparent insufficiency of every individual to his own


happiness or safety, compels us to seek from one another assistance
and support. The necessity of joint efforts for the execution of any
great or extensive design, the variety of powers disseminated in the
species, and the proportion between the defects and excellencies of
different persons, demand an interchange of help, and
communication of intelligence, and by frequent reciprocations of
beneficence unite mankind in society and friendship.
If it can be imagined that there ever was a time when the
inhabitants of any country were in a state of equality, without
distinction of rank, or peculiarity of possessions, it is reasonable to
believe that every man was then loved in proportion as he could
contribute by his strength, or his skill, to the supply of natural
wants; there was then little room for peevish dislike, or capricious
favour; the affection admitted into the heart was rather esteem than
tenderness; and kindness was only purchased by benefits. But when
by force or policy, by wisdom or by fortune, property and superiority
were introduced and established, so that many were condemned to
labour for the support of a few, then they whose possessions
swelled above their wants, naturally laid out their superfluities upon
pleasure; and those who could not gain friendship by necessary
offices, endeavoured to promote their interest by luxurious
gratifications, and to create needs, which they might be courted to
supply.
The desires of mankind are much more numerous than their
attainments, and the capacity of imagination much larger than actual
enjoyment. Multitudes are therefore unsatisfied with their allotment;
and he that hopes to improve his condition by the favour of another,
and either finds no room for the exertion of great qualities, or
perceives himself excelled by his rivals, will, by other expedients,
endeavour to become agreeable where he cannot be important, and
learn, by degrees, to number the art of pleasing among the most
useful studies, and most valuable acquisitions.
This art, like others, is cultivated in proportion to its usefulness,
and will always flourish most where it is most rewarded; for this
reason we find it practised with great assiduity under absolute
governments, where honours and riches are in the hands of one
man, whom all endeavour to propitiate, and who soon becomes so
much accustomed to compliance and officiousness, as not easily to
find, in the most delicate address, that novelty which is necessary to
procure attention.
It is discovered by a very few experiments, that no man is much
pleased with a companion, who does not increase, in some respect,
his fondness of himself; and, therefore, he that wishes rather to be
led forward to prosperity by the gentle hand of favour, than to force
his way by labour and merit, must consider with more care how to
display his patron's excellencies than his own; that whenever he
approaches, he may fill the imagination with pleasing dreams, and
chase away disgust and weariness by a perpetual succession of
delightful images.
This may, indeed, sometimes be effected by turning the attention
upon advantages which are really possessed, or upon prospects
which reason spreads before hope; for whoever can deserve or
require to be courted, has generally, either from nature or from
fortune, gifts, which he may review with satisfaction, and of which,
when he is artfully recalled to the contemplation, he will seldom be
displeased.
But those who have once degraded their understanding to an
application only to the passions, and who have learned to derive
hope from any other sources than industry and virtue, seldom retain
dignity and magnanimity sufficient to defend them against the
constant recurrence of temptation to falsehood. He that is too
desirous to be loved, will soon learn to flatter, and when he has
exhausted all the variations of honest praise, and can delight no
longer with the civility of truth, he will invent new topicks of
panegyrick, and break out into raptures at virtues and beauties
conferred by himself.
The drudgeries of dependance would, indeed, be aggravated by
hopelessness of success, if no indulgence was allowed to adulation.
He that will obstinately confine his patron to hear only the
commendations which he deserves, will soon be forced to give way
to others that regale him with more compass of musick. The
greatest human virtue bears no proportion to human vanity. We
always think ourselves better than we are, and are generally
desirous that others should think us still better than we think
ourselves. To praise us for actions or dispositions which deserve
praise, is not to confer a benefit, but to pay a tribute. We have
always pretensions to fame, which, in our own hearts, we know to
be disputable, and which we are desirous to strengthen by a new
suffrage; we have always hopes which we suspect to be fallacious,
and of which we eagerly snatch at every confirmation.
It may, indeed, be proper to make the first approaches under the
conduct of truth, and to secure credit of future encomiums, by such
praise as may be ratified by the conscience; but the mind once
habituated to the lusciousness of eulogy, becomes, in a short time,
nice and fastidious, and, like a vitiated palate, is incessantly calling
for higher gratifications.
It is scarcely credible to what degree discernment may be dazzled
by the mist of pride, and wisdom infatuated by the intoxication of
flattery; or how low the genius may descend by successive
gradations of servility, and how swiftly it may fall down the precipice
of falsehood. No man can, indeed, observe, without indignation, on
what names, both of ancient and modern times, the utmost
exuberance of praise has been lavished, and by what hands it has
been bestowed. It has never yet been found, that the tyrant, the
plunderer, the oppressor, the most hateful of the hateful, the most
profligate of the profligate, have been denied any celebrations which
they were willing to purchase, or that wickedness and folly have not
found correspondent flatterers through all their subordinations,
except when they have been associated with avarice or poverty, and
have wanted either inclination or ability to hire a panegyrist.
As there is no character so deformed as to fright away from it the
prostitutes of praise, there is no degree of encomiastick veneration
which pride has refused. The emperors of Rome suffered themselves
to be worshipped in their lives with altars and sacrifices; and, in an
age more enlightened, the terms peculiar to the praise and worship
of the Supreme Being, have been applied to wretches whom it was
the reproach of humanity to number among men; and whom
nothing but riches or power hindered those that read or wrote their
deification, from hunting into the toils of justice, as disturbers of the
peace of nature.
There are, indeed, many among the poetical flatterers, who must
be resigned to infamy without vindication, and whom we must
confess to have deserted the cause of virtue for pay; they have
committed, against full conviction, the crime of obliterating the
distinctions between good and evil, and, instead of opposing the
encroachments of vice, have incited her progress, and celebrated
her conquests. But there is a lower class of sycophants, whose
understanding has not made them capable of equal guilt. Every man
of high rank is surrounded with numbers, who have no other rule of
thought or action, than his maxims, and his conduct; whom the
honour of being numbered among his acquaintance, reconciles to all
his vices, and all his absurdities; and who easily persuade
themselves to esteem him, by whose regard they consider
themselves as distinguished and exalted.
It is dangerous for mean minds to venture themselves within the
sphere of greatness. Stupidity is soon blinded by the splendour of
wealth, and cowardice is easily fettered in the shackles of
dependance. To solicit patronage, is, at least, in the event, to set
virtue to sale. None can be pleased without praise, and few can be
praised without falsehood; few can be assiduous without servility,
and none can be servile without corruption.
No. 105.
TUESDAY, MARCH 19, 1751.

——Animorum
Impulsu, et cæcâ magnâque cupidine ducti.

Juv. Sat. x. 350.

Vain man runs headlong, to caprice resign'd;


Impell'd by passion, and with folly blind.

I was lately considering, among other objects of speculation, the


new attempt of an universal register, an office, in which every man
may lodge an account of his superfluities and wants, of whatever he
desires to purchase or to sell. My imagination soon presented to me
the latitude to which this design may be extended by integrity and
industry, and the advantages which may be justly hoped from a
general mart of intelligence, when once its reputation shall be so
established, that neither reproach nor fraud shall be feared from it:
when an application to it shall not be censured as the last resource
of desperation, nor its informations suspected as the fortuitous
suggestions of men obliged not to appear ignorant. A place where
every exuberance may be discharged, and every deficiency supplied;
where every lawful passion may find its gratifications, and every
honest curiosity receive satisfaction; where the stock of a nation,
pecuniary and intellectual, may be brought together, and where all
conditions of humanity may hope to find relief, pleasure, and
accommodation; must equally deserve the attention of the merchant
and philosopher, of him who mingles in the tumult of business, and
him who only lives to amuse himself with the various employments
and pursuits of others. Nor will it be an uninstructing school to the
greatest masters of method and dispatch, if such multiplicity can be
preserved from embarrassment, and such tumult from inaccuracy.
While I was concerting this splendid project, and filling my
thoughts with its regulation, its conveniences, its variety, and its
consequences, I sunk gradually into slumber; but the same images,
though less distinct, still continued to float upon my fancy. I
perceived myself at the gate of an immense edifice, where
innumerable multitudes were passing without confusion; every face
on which I fixed my eyes, seemed settled in the contemplation of
some important purpose, and every foot was hastened by eagerness
and expectation. I followed the crowd without knowing whither I
should be drawn, and remained a while in the unpleasing state of an
idler, where all other beings were busy, giving place every moment
to those who had more importance in their looks. Ashamed to stand
ignorant, and afraid to ask questions, at last I saw a lady sweeping
by me, whom, by the quickness of her eyes, the agility of her steps,
and a mixture of levity and impatience, I knew to be my long-loved
protectress, Curiosity. "Great goddess," said I, "may thy votary be
permitted to implore thy favour; if thou hast been my directress from
the first dawn of reason, if I have followed thee through the maze of
life with invariable fidelity, if I have turned to every new call, and
quitted at thy nod one pursuit for another, if I have never stopped at
the invitations of fortune, nor forgot thy authority in the bowers of
pleasure, inform me now whither chance has conducted me."
"Thou art now," replied the smiling power, "in the presence of
Justice, and of Truth, whom the father of gods and men has sent
down to register the demands and pretentions of mankind, that the
world may at last be reduced to order, and that none may complain
hereafter of being doomed to tasks for which they are unqualified, of
possessing faculties for which they cannot find employment, or
virtues that languish unobserved for want of opportunities to exert
them, of being encumbered with superfluities which they would
willingly resign, or of wasting away in desires which ought to be
satisfied. Justice is now to examine every man's wishes, and Truth is
to record them; let us approach, and observe the progress of this
great transaction."
She then moved forward, and Truth, who knew her among the
most faithful of her followers, beckoned her to advance, till we were
placed near the seat of Justice. The first who required the assistance
of the office, came forward with a slow pace, and tumour of dignity,
and shaking a weighty purse in his hand, demanded to be registered
by Truth, as the Mæcenas of the present age, the chief encourager
of literary merit, to whom men of learning and wit might apply in
any exigence or distress with certainty of succour. Justice very mildly
inquired, whether he had calculated the expense of such a
declaration? whether he had been informed what number of
petitioners would swarm about him? whether he could distinguish
idleness and negligence from calamity, ostentation from knowledge,
or vivacity from wit? To these questions he seemed not well provided
with a reply, but repeated his desire to be recorded as a patron.
Justice then offered to register his proposal on these conditions, that
he should never suffer himself to be flattered; that he should never
delay an audience when he had nothing to do; and that he should
never encourage followers without intending to reward them. These
terms were too hard to be accepted; for what, said he, is the end of
patronage, but the pleasure of reading dedications, holding
multitudes in suspense, and enjoying their hopes, their fears, and
their anxiety, flattering them to assiduity, and, at last, dismissing
them for impatience? Justice heard his confession, and ordered his
name to be posted upon the gate among cheats and robbers, and
publick nuisances, which all were by that notice warned to avoid.
Another required to be made known as the discoverer of a new art
of education, by which languages and sciences might be taught to
all capacities, and all inclinations, without fear of punishment, pain
or confinement, loss of any part of the gay mein of ignorance, or any
obstruction of the necessary progress in dress, dancing, or cards.
Justice and Truth did not trouble this great adept with many
inquiries; but finding his address awkward and his speech barbarous,
ordered him to be registered as a tall fellow who wanted
employment, and might serve in any post where the knowledge of
reading and writing was not required.
A man of very grave and philosophick aspect, required notice to
be given of his intention to set out, a certain day, on a submarine
voyage, and of his willingness to take in passengers for no more
than double the price at which they might sail above water. His
desire was granted, and he retired to a convenient stand, in
expectation of filling his ship, and growing rich in a short time by the
secrecy, safety, and expedition of the passage.
Another desired to advertise the curious, that he had, for the
advancement of true knowledge, contrived an optical instrument, by
which those who laid out their industry on memorials of the changes
of the wind, might observe the direction of the weather-cocks on the
hitherside of the lunar world.
Another wished to be known as the author of an invention, by
which cities or kingdoms might be made warm in winter by a single
fire, a kettle, and pipe. Another had a vehicle by which a man might
bid defiance to floods, and continue floating in an inundation,
without any inconvenience, till the water should subside. Justice
considered these projects as of no importance but to their authors,
and therefore scarcely condescended to examine them: but Truth
refused to admit them into the register.
Twenty different pretenders came in one hour to give notice of an
universal medicine, by which all diseases might be cured or
prevented, and life protracted beyond the age of Nestor. But Justice
informed them, that one universal medicine was sufficient, and she
would delay the notification till she saw who could longest preserve
his own life.
A thousand other claims and offers were exhibited and examined.
I remarked, among this mighty multitude, that, of intellectual
advantages, many had great exuberance, and few confessed any
want; of every art there were a hundred professors for a single
pupil; but of other attainments, such as riches, honours, and
preferments, I found none that had too much, but thousands and
ten thousands that thought themselves entitled to a larger dividend.
It often happened, that old misers, and women married at the
close of life, advertised their want of children; nor was it uncommon
for those who had a numerous offspring, to give notice of a son or
daughter to be spared; but, though appearances promised well on
both sides, the bargain seldom succeeded; for they soon lost their
inclination to adopted children, and proclaimed their intentions to
promote some scheme of publick charity: a thousand proposals were
immediately made, among which they hesitated till death precluded
the decision.
As I stood looking on this scene of confusion, Truth condescended
to ask me, what was my business at her office? I was struck with the
unexpected question, and awaked by my efforts to answer it.
END OF VOL. II.
TALBOYS AND WHEELER.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like