DSP for MATLAB and LabVIEW I Fundamentals of Discrete Signal Processing Synthesis Lectures on Signal Processing Isen - Download the ebook and explore the most detailed content
DSP for MATLAB and LabVIEW I Fundamentals of Discrete Signal Processing Synthesis Lectures on Signal Processing Isen - Download the ebook and explore the most detailed content
com
https://ebookgate.com/product/dsp-for-matlab-and-labview-i-
fundamentals-of-discrete-signal-processing-synthesis-
lectures-on-signal-processing-isen/
OR CLICK BUTTON
DOWLOAD EBOOK
https://ebookgate.com/product/dsp-for-matlab-and-labview-fundamentals-
of-discrete-frequency-transforms-forester-w-isen/
ebookgate.com
https://ebookgate.com/product/think-dsp-digital-signal-processing-in-
python-1st-edition-downey/
ebookgate.com
https://ebookgate.com/product/prentice-discrete-time-digital-signal-
processing-2nd-edition-oppenheim/
ebookgate.com
https://ebookgate.com/product/digital-signal-processing-using-
matlab-1st-edition-andre-quinquis/
ebookgate.com
Instructor Solution Manual Fundamentals of Digital Signal
Processing Using MATLAB 2nd Edition Robert J. Schilling
https://ebookgate.com/product/instructor-solution-manual-fundamentals-
of-digital-signal-processing-using-matlab-2nd-edition-robert-j-
schilling/
ebookgate.com
https://ebookgate.com/product/multirate-filtering-for-digital-signal-
processing-matlab-applications-1st-edition-ljiljana-milic/
ebookgate.com
https://ebookgate.com/product/digital-signal-processing-using-
matlab-3rd-edition-vinay-k-ingle/
ebookgate.com
https://ebookgate.com/product/discrete-wavelet-transform-a-signal-
processing-approach-1st-edition-d-sundararajan/
ebookgate.com
https://ebookgate.com/product/digital-signal-processing-fundamentals-
and-application-1st-edition-li-tan/
ebookgate.com
DSP for
MATLAB™ and LabVIEW™ I:
Fundamentals of
Discrete Signal Processing
Copyright © 2008 by Morgan & Claypool
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in
any form or by any means—electronic, mechanical, photocopy, recording, or any other except for brief quotations in
printed reviews, without the prior permission of the publisher.
DOI 10.2200/S000161ED1V01Y200811SPR004
Lecture #4
Series Editor: José Moura, Carnegie Mellon University
Series ISSN
Synthesis Lectures on Signal Processing
Print 1932-1236 Electronic 1932-1694
SYNTHESIS LECTURES
ON SIGNAL
PROCESSING
Editor
José Moura, Carnegie Mellon University
Forester W. Isen
M
&C Morgan & cLaypool publishers
ABSTRACT
This book is Volume I of the series DSP for MATLAB ™ and LabVIEW ™ . The entire series consists
of four volumes that collectively cover basic digital signal processing in a practical and accessible man-
ner, but which nonetheless include all essential foundation mathematics. As the series title implies, the
scripts (of which there are more than 200) described in the text and supplied in code form (available
via the internet at http://www.morganclaypool.com/page/isen will run on both MATLAB and
LabVIEW. Volume I consists of four chapters. The first chapter gives a brief overview of the field of dig-
ital signal processing. This is followed by a chapter detailing many useful signals and concepts, including
convolution, recursion, difference equations, LTI systems, etc. The third chapter covers conversion from
the continuous to discrete domain and back (i.e., analog-to-digital and digital-to-analog conversion),
aliasing, the Nyquist rate, normalized frequency, conversion from one sample rate to another, waveform
generation at various sample rates from stored wave data, and Mu-law compression. The fourth and final
chapter of the present volume introduces the reader to many important principles of signal processing,
including correlation, the correlation sequence, the Real DFT, correlation by convolution, matched fil-
tering, simple FIR filters, and simple IIR filters. Chapter 4, in particular, provides an intuitive or “first
principle” understanding of how digital filtering and frequency transforms work, preparing the reader
for Volumes II and III, which provide, respectively, detailed coverage of discrete frequency transforms
(including the Discrete Time Fourier Transform, the Discrete Fourier Transform, and the z-Transform)
and digital filter design (FIR design using Windowing, Frequency Sampling, and Optimum Equirip-
ple techniques, and Classical IIR design). Volume IV, the culmination of the series, is an introductory
treatment of LMS Adaptive Filtering and applications. The text for all volumes contains many examples,
and many useful computational scripts, augmented by demonstration scripts and LabVIEW Virtual In-
struments (VIs) that can be run to illustrate various signal processing concepts graphically on the user’s
computer screen.
KEYWORDS
Higher-Level Terms:
MATLAB, LabVIEW, DSP (Digital Signal Processing), Sampling, LTI Systems, Analog-
to-Digital, Digital-to-Analog, FIR, IIR, DFT,Time Domain, Frequency Domain, Aliasing,
Binary Numbers.
Lower Level Terms:
Correlation, Convolution, Matched Filtering, Orthogonality, Interpolation, Decimation,
Mu-Law, Stability, Causality, Difference Equations, Zero-Order Hold.
This volume is dedicated to the following memorable teachers
of mine: Louise Costa, Cdr. Charles Bradimore Brouillette, Rudd
Crawford, Sheldon Sarnevitz, Dr. C. W. Rector, Dr. Samuel Saul
Saslaw, and Dr. R. D. Shelton.
ix
Contents
SYNTHESIS LECTURES ON SIGNAL PROCESSING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
0.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
0.2 The Four Volumes of the Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xv
0.3 Origin and Evolution of the Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
1 An Overview of DSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Signals, Waves, and Digital Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Advantages of Digital Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 DSP Nomenclature and Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3.1 Time Domain Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3.2 Frequency Transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3.3 Frequency Domain Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
1.4 Organization of this Volume of the Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Contents of Volume II in the Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.6 Contents of Volume III in the Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.7 Contents of Volume IV in the Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Biography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
xiv CONTENTS
Preface to Volume I
0.1 INTRODUCTION
The present volume is Volume I of the series DSP for MATLAB ™ and LabVIEW ™ . The entire series
consists of four volumes which collectively form a work of twelve chapters that cover basic digital signal
processing in a practical and accessible manner, but which nonetheless include the necessary foundation
mathematics. The text is well-illustrated with examples involving practical computation using m-code
or MathScript (as m-code is usually referred to in LabVIEW-based literature), and LabVIEW VIs.
There is also an ample supply of exercises, which consist of a mixture of paper-and-pencil exercises for
simple computations, and script-writing projects having various levels of difficulty, from simple, requiring
perhaps ten minutes to accomplish, to challenging, requiring several hours to accomplish.
As the series title implies, the scripts given in the text and supplied in code form (available via the
internet at http://www.morganclaypool.com/page/isen) are suitable for use with both MATLAB (a
product of The Mathworks, Inc.), and LabVIEW (a product of National Instruments, Inc.). Appendix
A in each volume of the series describes the naming convention for the software written for the book as
well as basics for using the software with MATLAB and LabVIEW.
Forester W. Isen
November 2008
1
CHAPTER 1
An Overview of DSP
1.1 SIGNALS, WAVES, AND DIGITAL PROCESSING
Two of the human senses, sight and hearing, work via the detection of waves. Useful information from
both light and sound is gained by detection of certain characteristics of these waves, such as frequency and
amplitude. Modern telecommunication depends on transducing sound or light into electrical quantities
such as voltage, and then processing the voltage in many different ways to enable the information to
be reliably stored or conveyed to a distant place and then regenerated to imitate (i.e., reconstruct) the
original sound or light phenomenon.
For example, in the case of sound, a microphone detects rapid pressure variations in air and converts
those variations to an output voltage which varies in a manner proportional to the variation of pressure
on the microphone’s diaphragm. The varying voltage can be used to cut a corresponding wave into a
wax disc, to record corresponding wave-like variations in magnetism onto a ferromagnetic wire or tape,
to vary the opacity of a linear track along the edge of a celluloid film (i.e., the sound-track of a motion
picture film) or perhaps to modulate a carrier wave for radio transmission.
In recent decades, signal processing and storage systems have been developed that use discrete
samples of a signal rather than the entire continuous time domain (or analog) signal. Several useful
definitions are as follows:
• A sample is the amplitude of an analog signal at an instant in time.
• A system that processes a signal in sampled form (i.e., a sequence of samples) is known as a Discrete
Time Signal Processing System.
• In a Digital Signal Processing system, the samples are converted to numerical values, and the
values (numbers) stored (usually in binary form), transmitted, or otherwise processed.
The difference between conventional analog systems and digital systems is illustrated in Fig. 1.1.
At (a), a conventional analog system is shown, in which the signal from a microphone is sent directly to
an analog recording device, such as a tape recorder, recorded at a certain tape speed, and then played back
at the same speed some time later to reproduce the original sound. At (b), samples of the microphone
signal are obtained by an Analog-to-Digital Converter (ADC), which converts instantaneous voltages
of the microphone signal to corresponding numerical values, which are stored in a digital memory, and
can later be sent to a Digital-to-Analog Converter (DAC) to reconstruct the original sound.
In addition to recording and reproducing analog signals, most other kinds of processing which
might be performed on an analog signal can also be performed on a sampled version of the signal by
using numerical algorithms. These can be categorized into two broad types of processing, time domain
and frequency domain, which are discussed in more detail below.
(a)
(b)
Figure 1.1: (a) Conventional analog recording and playback system; (b) A digital recording and playback
system.
1. Analog hardware, such as amplifiers, filters, comparators, etc., is very susceptible to noise and
deterioration through aging. Digital hardware works with only two signal levels rather than an infinite
number, and hence has a high signal to noise ratio. As a result, there is little if any gradual deterioration
of performance with age (although as with all things, digital hardware can suddenly and totally fail),
and copies of signal files are generally perfect, absent component failure, media degeneration or damage,
etc. This is not true with analog hardware and recording techniques, in which every copy introduces
significant amounts of additional noise and distortion.
2. Analog hardware, for the most part, must be built for each processing function needed. With
digital processing, each additional function needed can be implemented with a software module, using
the same piece of hardware, a digital computer. The computing power available to the average person
has increased enormously in recent years, as evidenced by the incredible variety of inexpensive, high
quality devices and techniques available. Hundreds of millions or billions of operations per second can
be performed on a signal using digital hardware at reasonable expense; no reasonably-priced alternative
exists using analog hardware and processing.
3. Analog signal storage is typically redundant, since wave-related signals (audio, video, etc.) are
themselves typically redundant. For example, by taking into account this redundancy as well as the
physiological limitations of human hearing, storage needs for audio signals can be reduced up to about
95%, using digitally-based compression techniques, such as MP3, AC3, AAC, etc.
4. Digital processing makes possible highly efficient security and error-correction coding. Using
digital coding, it is possible, for example, for many signals to be transmitted at very low power and to
1.3. DSP NOMENCLATURE AND TOPICS 3
share the same bandwidth. Modern cell phone techniques, such as CDMA (Code Division Multiple
Access) rely heavily on advanced, digitally-based signal processing techniques to efficiently achieve both
high quality and high security.
Time to Frequency
Frequency to Time
Transform Transform
Frequency Domain
Processing
• Chapter 1 (the present chapter) gives a brief overview of DSP. It defines sampling, contrasts the
areas of continuous and discrete signal processing, as well as time domain and frequency domain
processing, and introduces very basic signal processing nomenclature.
• Chapter 2 introduces many useful signals and sequences, followed by a basic introduction to Linear,
Time Invariant (LTI) systems, including convolution, stability and causality, basic FIR and IIR
filters, and difference equations.
• Chapter 1 begins with a short overview of the Fourier and Laplace families of transforms, calling
attention to the uses of each and the differences among them. The remainder of the chapter is
devoted to the Discrete Time Fourier Transform (DTFT), its properties, and its use in evaluation
of the frequency response of an LTI system.
• Chapter 2 introduces the z-transform, its properties, the inverse z-transform, transfer function
and various filter topologies (Direct, Cascade, Parallel, and Lattice Forms), and evaluation of the
frequency response of an LTI system using the z-transform.
• Chapter 3 covers the Discrete Fourier Transform (DFT), including the forward and reverse trans-
forms, properties, the Fast Fourier Transform (FFT), the Goertzel Algorithm, periodic, cyclic, and
linear convolution via the DFT, and DFT leakage. Computation of the IDFT (inverse DFT) via
DFT, computation of the DFT via matrix, and computation of the DTFT via the DFT, are also
discussed.
• Chapter 1 gives an overview of FIR filtering principles in general, and linear phase filter charac-
teristics in particular, and an overview of FIR design techniques.
• Chapter 2 covers FIR design via windowed ideal lowpass filter, frequency sampling with optimized
transition coefficients (as implemented by inverse DFT as well as cosine/sine summation formulas),
and equiripple design. Designs are performed for lowpass, highpass, bandpass, and bandstop filters,
as well as Hilbert transformers and differentiators.
• Chapter 3 is devoted to classical IIR design, including design of digital IIR filters starting from
analog prototype lowpass filters of the Butterworth, Chebyshev (I and II), and Elliptic types,
transformations from lowpass to other passband types in the analog domain, and analog-to-digital
filter transformation. The chapter concludes with a discussion of various filter design functions
provided by MATLAB and LabVIEW.
6 CHAPTER 1. AN OVERVIEW OF DSP
CHAPTER 2
http://www.morganclaypool.com/page/isen
The entire software package should be stored in a single folder on the user’s computer, and the full
file name of the folder must be placed on the MATLAB or LabVIEW search path in accordance with the
instructions provided by the respective software vendor (in case you have encountered this notice before,
which is repeated for convenience in each chapter of the book, the software download only needs to be
done once, as files for the entire series of four volumes are all contained in the one downloadable folder).
See Appendix A for more information.
0.5
Amplitude
−0.5
−1
0 0.5 1 1.5 2
Time, sec
Figure 2.1: An analog or continuous-domain sine wave, with eight samples per second marked.
The samples within a given sample sequence are normally indexed by the numbers 0, 1, 2, etc.,
which represent multiples of the sample period T . For example, in Fig. 2.1, we note that the sample
period is 0.125 second, and the actual sampling times are therefore 0 sec., 0.125 sec., 0.25 sec., etc. The
continuous sine function shown has the value
f (t) = sin(2πf t)
where t is time, f is frequency, and in this particular case, f = 1 Hz. Sampling occurs at times nT
where n = 0, 1, 2,...and T = 0.125 second. The sample values of the sequence would therefore be sin(0),
sin(2π(T )), sin(2π(2T )), sin(2π(3T )), etc., and we would then say that s[0] = 0, s[1] = 0.707, s[2] =
1.0, s[3] = 0.707, etc. where s[n] denotes the n-th sequence value, the amplitude of which is equal to the
underlying continuous function at time nT (note that brackets surrounding a function argument mean
that the argument can only assume discrete values, while parentheses surrounding an argument indicate
that the argument’s domain is continuous). We can also say that
s[n] = sin[2π nT ]
2.4. USEFUL SIGNALS, SEQUENCES, AND CONCEPTS 9
This sequence of values, the samples of the sine wave, can be used to completely reconstruct the
original continuous domain sine wave using a DAC. There are, of course, a number of conditions to
ensure that this is possible, and they are taken up in detail in the next chapter.
To compute and plot the sample values of a 2-Hz sine wave sampled every 0.05 second on the
time interval 0 to 1.1 second, make the following MathScript call:
1
0.8
0.6
0.4
Amplitude
0.2
0
−0.2
−0.4
−0.6
−0.8
−1
Figure 2.2: A plot of the samples of a sine wave having frequency 2 Hz, sampled every 0.05 second up
to time 1.1 second.
s[n] = sin[2πf nT ]
10 CHAPTER 2. DISCRETE SIGNALS AND CONCEPTS
Once we have a sampled sine wave, we can mathematically express it without reference to the
sampling period by defining the sequence length as N . We would then have, in general,
1
Amplitude
−1
0 2 4 6 8 10 12 14 16
Sample
1
Amplitude
−1
0 2 4 6 8 10 12 14 16
Sample
1
Amplitude
−1
0 2 4 6 8 10 12 14 16
Sample
Figure 2.3: (a) Three cycles of a sine wave over 18 samples, with phase angle 0 radians; (b) Same as (a),
with a phase angle of π/2 radians; (c) Three cycles of a cosine wave over 18 samples, with a phase angle
of 0 radians.
The following script will perform addition of offset sequences y1 and y2 that have respective time
indices n1 and n2 using the method of prepending and postpending zeros.
function [y, nOut] = LVAddSeqs(y1,n1,y2,n2)
nOut = [min(min(n1),min(n2)):1:max(max(n1),max(n2))];
mnfv = min(nOut); mxfv = max(nOut);
y = [zeros(1,min(n1)-mnfv),y1,zeros(1,mxfv-max(n1))] + ...
[zeros(1,min(n2)-mnfv),y2,zeros(1,mxfv-max(n2))];
The function
[y, nOut] = LV MultSeqs(y1, n1, y2, n2)
works the same way, with the addition operator (+) in the final statement being replaced with the operator
for multiplying two vectors on a sample-by-sample basis, a period following by an asterisk ( .* ).
We can illustrate use of the function LV AddSeqs by using it to add the following sequences:
y1 = [3,-2,2], n1 = [-1,0,1], y2 = [1,0,-1], n2 = [0,1,2]
12 CHAPTER 2. DISCRETE SIGNALS AND CONCEPTS
4
y1
−2 −1 0 1 2 3 4 5 6
(a) Composite Sample Range n
6
4
y2
−2 −1 0 1 2 3 4 5 6
(b) Composite Sample Range n
Figure 2.4: (a) First sequence, with postpended zeros at sample times 3, 4, and 5; (b) Second sequence,
with prepended zeros at sample times -1, 0, and 1.
LVPlotUnitImpSeq(-2,-10,10)
A version of the script that returns the output sequence and its indices without plotting is
[xVals,xIndices] = LVUnitImpSeq(n,Nlow,Nhigh)
This version is useful for generating composite unit impulse sequences. For example, we can display,
over the sample index interval -5 to 5, the output sequence
by using the following m-code, which computes and displays the desired output sequence using the
function LVUnitImpSeq, as shown in Fig. 2.5.
[y1,y1Ind] = LVUnitImpSeq(2,-5,5),
[y2,y2Ind] = LVUnitImpSeq(-3,-5,5),
y = 3*y1 - 2*y2, stem(y1Ind,y)
2
Amplitude
−1
−2
−3
−5 0 5
Sample Index
Figure 2.5: A graph of the function y[n] = 3[n − 2] − 2[n + 3] for sample indices -5 to +5.
function LVPlotUnitStepSeq(n,Nlow,Nhigh)
xIndices = [Nlow:1:Nhigh];
yVals(1:1:length(xIndices)) = 0;
posZInd = find((xIndices-n)==0)
yVals(posZInd:1:length(xIndices)) = 1;
stem(xIndices,yVals)
An example MathScript call is
LVPlotUnitStepSeq(-2,-10,10)
A version of the script that returns the output sequence and its indices without plotting is
y = u[n + 1] − u[n − 3]
To verify, we can modify the code from the previous example; the results are shown in Fig. 2.6.
[y1,y1Ind] = LVUnitStepSeq(-1,-10,10);
[y2,y2Ind] = LVUnitStepSeq(3,-10,10);
y = y1 - y2; stem(y1Ind,y)
0.5
Amplitude
−0.5
−1
−10 −5 0 5 10
Sample Index
Figure 2.6: A plot over time indices -10 to +10 of the sequence defined as y[n] = u[n + 1] − u[n − 3].
y[n] = a n
16 CHAPTER 2. DISCRETE SIGNALS AND CONCEPTS
where a is a real number and n is real integer, produces a real sequence. In MathScript, to raise a number
to a single power, use the "ˆ" operator; to raise a number to a vector of powers, use the ".ˆ" operator.
To illustrate this, we can generate and plot a real exponential sequence with a = 2 and n = [0:1:6].
A suitable MathScript call is
0.8
Amplitude
0.6
0.4
0.2
0
−7 −6 −5 −4 −3 −2 −1 0 1
n
Figure 2.7: A real exponential sequence formed by raising the number 2 to the powers [-6:1:0].
cos(2*pi*[0:1:10]/11)
and a suitable call that computes and plots the result is therefore
N = 3; y = [cos(2*pi*[0:1:10]/11)]’;
nY = LVMakePeriodicSeq(y,N); stem(nY )
(MaxH ar+1)/2
y[n] = (1/(2k − 1)) sin(2πf (2k − 1)(n/N )) (2.1)
k=1
For a sawtooth wave, all harmonics are included:
ar
MaxH
y[n] = (1/k) sin(2πf k(n/N ))
k=1
To illustrate the above formulas in terms of m-code, we will synthesize square and sawtooth waves
having 10 cycles, up to the 99th harmonic.
We compute the necessary minimum sequence length as 2(10)(99) = 1980. The following Math-
Script call will synthesize a square wave up to the 99th harmonic; note that only odd harmonics are
included, i.e., k = 1:2:99.
N=1980; n = 0:1:N; y = 0; for k = 1:2:99;
y = y + (1/k)*sin(2*pi*10*k*n/N); end; figure; plot(y)
For a sawtooth wave, the harmonic values are specified as 1:1:99, thus including both odd and
even values:
18 CHAPTER 2. DISCRETE SIGNALS AND CONCEPTS
N=1980; n = 0:1:N; y = 0; for k=1:1:99;
y = y + (1/k)*sin(2*pi*10*k*n/N); end; figure; plot(y)
The script
0.5
Amplitude
−0.5
−1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
(a) Component Waves (X−axis = time, sec): Press Any Key to Continue
1
0.5
Amplitude
0
−0.5
−1
0 0.2 0.4 0.6 0.8
(b) Sum of All Components to Harmonic 5; X−axis = time, sec
Figure 2.8: (a) The first three weighted harmonics of a square wave; (b) Superposition of the waves
shown in (a).
xe = 0.5*(x + fliplr(x))
and the corresponding odd decomposition xo is
xo = 0.5*(x - fliplr(x))
We can write a simple function that generates the even and odd components of an input sequence
x[n] as follows:
function [xe,xo] = LVEvenOdd(x)
xe = (x + fliplr(x))/2; xo = (x - fliplr(x))/2;
We can illustrate use of the above script with a simple example; assuming that x[n] = [1,3,5,7], we’ll
generate an even/odd decomposition and verify its correctness by summing the even and odd components,
and comparing to the original input signal x[n].
x = [1,3,5,7];
[xe,xo] = LVEvenOdd(x)
recon = xe + xo, diff = x - recon
From the above we get xe = [4,4,4,4] and xo = [-3,-1,1,3], the sum of which is [1,3,5,7], i.e., the
original sequence x.
Another useful even/odd decomposition is defined such that
xe[n] = xe[−n]
and
xo[n] = −xo[−n]
20 CHAPTER 2. DISCRETE SIGNALS AND CONCEPTS
In this case, the decompositions exhibit their symmetry about n = 0 rather than about the midpoint
of the original sequence x. For example, if x = [1,2,3,4] with corresponding sample indices n = [3,4,5,6],
a decomposition about n = 0 can be accomplished by padding x with zeros in such a manner to create a
new sequence with time indices symmetrical about zero. In this case, the new sequence is
x = [zeros(1,9),1,2,3,4]
having sample indices [-6:1:6]. The new sequence x is then decomposed as above, i.e.,
x = [zeros(1,9),1,2,3,4];
[xe,xo] = LVEvenOdd(x)
recon = xe + xo, diff = x - recon
A script that performs an even-odd decomposition about zero and returns the even and odd parts
and corresponding indices without plotting is
function [xe,xo,m] = LVEvenOddSymmZero(x,n)
m = -fliplr(n); m1=min([m,n]); m2 = max([m,n]); m = m1:m2;
nm = n(1)-m(1); n1 = 1:1:length(n); x1 = zeros(1,length(m));
x1(n1+nm) = x; xe = 0.5*(x1 + fliplr(x1));
xo = 0.5*(x1 - fliplr(x1));
The call
[xe,xo,m] = LVEvenOddSymmZero([1,2,3],[3,4,5])
for example, yields
xe = [1.5,1,0.5,0,0,0,0,0,0.5,1,1.5]
xo = [-1.5,-1,-0.5,0,0,0,0,0,0.5,1,1.5]
m = [-5:1:5]
The script (see exercises below)
LV xEvenOddAboutZero(x, n)
performs a symmetric-about-zero even-odd decomposition and plots the results. Figure 2.9, which was
generated by making the script call
LVxEvenOddAboutZero([0.9.ˆ([0:1:30])],[0:1:30])
shows the result of this process when applied to the sequence x having sample indices n = [0:1:30], where
x = 0.9.ˆ([0:1:30])
2.4. USEFUL SIGNALS, SEQUENCES, AND CONCEPTS 21
1.5
1
xe
0.5
0
−30 −20 −10 0 10 20 30
(a) Sample Index n
0.5
xo
−0.5
−30 −20 −10 0 10 20 30
(b) Sample Index n
1.5
xe + xo
0.5
0
−30 −20 −10 0 10 20 30
(c) Sample Index n
Figure 2.9: (a) Even component of a decaying exponential sequence; (b) Odd component of same;
(c) Reconstruction of original exponential sequence, obtained by summing the even and odd components
shown in (a) and (b).
which allows computation of the sum starting from a value of n greater than 0.
Another way of thinking of this is that the sum of a geometric sequence a n (we assume |a| <1) is
its first term divided by one minus the convergence ratio R, where
22 CHAPTER 2. DISCRETE SIGNALS AND CONCEPTS
R = a n /a n−1
For example, we can determine the sum of the following sequence using Eq. (2.3), where N = 0:
N−1 ∞
∞
1 aN 1 − aN
an = an − an = − =
1−a 1−a 1−a
n=0 n=0 n=N
rand(m, n) or randn(m, n)
where m and n are dimensions of the matrix of random numbers to be created.
2.4. USEFUL SIGNALS, SEQUENCES, AND CONCEPTS 23
The first function above generates a random signal having uniform distribution over the interval
from 0 to 1; the second function above generates a signal having a Gaussian (or normal) distribution with
a mean of 0 and standard deviation of 1 .
As an m-code example, we’ll generate a signal containing noise of standard deviation 0.125 and
a cosine of frequency 11 over 128 samples, and plot the result. The result from running the following
m-code is shown in Fig. 2.10.
1
Amp
0
−1
−2
0 20 40 60 80 100 120
(a) Sample
1
Amp
0
−1
−2
0 20 40 60 80 100 120
(b) Sample
1
Amp
0
−1
−2
0 20 40 60 80 100 120
(c) Sample
Figure 2.10: (a) A cosine sequence of amplitude 1.0; (b) Gaussian or white noise having standard
deviation of 0.125; (c) The sum of the sequences at (a) and (b).
n = 0.125*randn(1,128); c = cos(2*pi*11*[0:127]/128);
figure(3); subplot(311); stem(c);
subplot(312); stem(n)
subplot(313); stem(n+c)
2.4.12 CHIRP
A sinusoid, such as a cosine wave, having a frequency that continuously increases with time, is expressed
in the continuous domain as
y = cos(βt 2 )
Since the sampled version would have discrete sample times at nT , we would have
24 CHAPTER 2. DISCRETE SIGNALS AND CONCEPTS
y[n] = cos[βn2 T 2 ]
Figure 2.11 shows a sampled chirp with β = 49, T = 1/256, and n = 0:1:255.
1
0.8
0.6
0.4
cos(49(nT) )
0.2
2
0
−0.2
−0.4
−0.6
−0.8
−1
0 50 100 150 200 250
n
The chirp is a useful signal for testing the frequency response of a system such as a filter. A similar
continuous domain technique is the use of a sweep generator to reveal the frequency response of analog
circuits, such as the video intermediate frequency circuits in TV sets.
Other common uses for the chirped sinusoid are radar and ultrasonic imaging In both cases, a chirp
is transmitted toward a target, with the expectation of receiving a reflection at a later time. Since the time
of transmission of any frequency in the chirp is known, and the frequency and time received are known for
any reflection, the difference in time between the transmission and reception times is directly available.
Since the velocity of the transmitted wave is known, the distance between the transmitter/receiver and
the point of reflection on the target object can be readily determined.
MathScript’s chirp function, in its simplest form, is
y = chirp(t, f 0, t1, f 1)
where t is a discrete time vector, f 0 and f 1 are the start and end frequencies, respectively, and t1 is the
time at which frequency f 1 occurs.
2.4. USEFUL SIGNALS, SEQUENCES, AND CONCEPTS 25
As an m-code example, we can generate a chirp that starts at frequency 0 and ends at frequency
50, over 1101 samples:
y = ej x
where e is the base of the natural logarithm system and j is the square root of negative one, generates a
complex number lying on the unit circle in the complex plane, i.e., the number has a magnitude of 1.0.
Such an exponential is equivalent to
y = exp(j*2*pi*(1/8))
A complex number that is repeatedly multiplied by itself generates a sequence of numbers (or
samples) having real and imaginary parts which respectively define cosine and sine waves. Think of two
complex numbers in polar form: the product has a magnitude equal to the product of the two magnitudes,
and an angle equal to the sum of the angles. From this it can be seen that repeatedly multiplying a complex
number by itself results in a sequence of complex numbers whose angles progress around the origin of
the complex plane by equal increments, and the real and imaginary parts of which form, respectively, a
sampled cosine sequence and a sampled sine sequence. If n represents a vector of powers, such as 0:1:N ,
for example, then the complex power sequence is
LVxComplexPowerSeries(0.99*exp(j*pi/18),40)
shows the real and imaginary parts of an entire sequence of complex numbers created by raising the
original complex number W (magnitude of 0.99 at an angle of 10 degrees (π /18 radians)) to the powers
0 to 40. Note that the real part, at (c), is a cosine, and the imaginary part, at (d), is a sine wave.
26 CHAPTER 2. DISCRETE SIGNALS AND CONCEPTS
1
1
0.5
Imaginary
Magnitude
0
0.5
−0.5
−1
0
0 10 20 30 40 −1 −0.5 0 0.5 1
(a) n (b) Real
1 1
0.5 0.5
Imaginary
Real
0 0
−0.5 −0.5
−1 −1
0 10 20 30 40 0 10 20 30 40
(c) n (d) n
Figure 2.12: (a) Magnitude of W = (0.99*exp(jπ /18))n where n = 0:1:40; (b) Plot of entire power sequence
in complex plane; (c) Real part of entire power sequence of W for powers 0 to 40; (d) Imaginary part of
entire power sequence of W for powers 0 to 40.
Let’s compute powers 0:1:3 for the complex number [0 + j] and describe or characterize the
resultant real and imaginary parts. The power sequence is [j0 , j1 , j2 , j3 ], which reduces to [1, j, -1, -j],
with the real parts being [1,0,-1,0] and the imaginary parts being [0,1,0,-1]. These may be described as
four-sample, single-cycle cosine and sine waves. Another way to write this would be
y = cos(2*pi*(0:1:3)/4) + j*sin(2*pi*(0:1:3)/4)
which returns the following:
e−j 2πnk/N
where n = [0,1,2,3], N = 4, and k = 2. This reduces to
cos(pi*(0:1:3)) + j*sin(pi*(0:1:3))
W = M exp(j 2π k/N )
the power sequence
[seqCos,seqSin] = LVGenFreq(1,7.5,73);
The result is shown in Fig. 2.13.
To illustrate the generation of a growing complex exponential, we’ll generate a cosine, sine pair
having a frequency of 3 cycles over 240 samples, and which increases in amplitude by a factor of 1.5 per
cycle. Since there are 240/3 samples per cycle, we take the 80th root of 1.5 as M. Code that makes the
computation of M easier and more flexible would be
Exploring the Variety of Random
Documents with Different Content
Bouillon or water
1 tbsp. of butter
2 yolks of eggs
½ pt. gravy or broth from the meat
Preparation: The meat is cut into small thin slices, also the
peeled potatoes. A casserole is buttered and filled with 1 layer of
raw potatoes, 1 layer of meat, salt, pepper and sliced onion. Repeat
twice, with potatoes for the last layer. Pour the gravy over, (if it is
too thick, dilute with cream or milk) put a few small pieces of butter
on top, bake in oven for 1½ hours.
If you have no left over gravy, make one of 1 tablespoonful of
browned butter, flour, water or bouillon, cream, pepper and salt.
Pour over the contents of the casserole and bake it.
Preparation: Meat, pickles, onions, all this cut into small pieces
and mixed well with the other ingredients, then garnished with hard-
boiled eggs.
The Paste.
1. Ham.
2. Pork Loin.
3. Pork Chops.
4. Pork Shoulder
5. Belly
6. Head
7. Snout
8. Shanks
9. Feet
4 lbs. of pork
Salt, pepper
3 cloves
1 bay-leaf
1 small onion
2 tbsps. of flour
1½ pts. of water
2 tbsps. of white wine
10 lbs. of ham
2 onions
6 cloves
2 bay-leaves
10 pepper-corns
Sufficient water
10 lbs. of ham
Sufficient water
Rye bread crumbs
1 tsp. of brown sugar
Cloves for larding
10 lbs. of ham
2 bottles of Burgundy wine
2 small sliced onions
A leek
1 piece of thyme
1 piece of marjoram
¼ lb. of truffles
1 very large pig’s bladder
2 tbsps. of butter
2½ tbsps. of flour
¼ pt. of Madeira
½ cup of bouillon
A cloth to tie up the ham
Water to boil in
¼ lb. of champignons
Preparation: The skin is cut off and the bones are taken out as
well as possible. To the wine add the onion, the chopped leek,
thyme and marjoram, then leave the ham in it for 24 hours, turning
it over often. After that take it out, make a stuffing of truffles,
champignons, 1 tablespoonful of butter, salt, pepper and ½ cup of
bouillon mixed well and stuff the cavity left after removing the bone
with it and sew it up. Clean the bladder well inside and outside,
make a cut into it and put the stuffed ham inside, then pour in the
wine with all its contents in which the ham has been lying for 24
hours, sew it up carefully. Then tie the whole into a white cloth and
put it on the fire in cold water to boil for 4 to 5 hours slowly. After
this, take the cloth off, open the suture, pour the fluid into a pot and
put the ham into a pan.
Brown the butter and flour, add some of the ham fluid and
Madeira, cook it well and add perhaps ½ teaspoonful of sugar,
(better taste the gravy first). Fill some of this gravy over the ham
and put it into the oven, roast for ¼ hour, then serve it with the
gravy. Ham prepared in this way is very fine. If wine cannot be had,
use Ginger Ale.
Preparation: The ham is put in milk for 6 hours, then dry off
the ham slices and fry them quickly in butter, put them on a platter
and pour the butter over. In the meantime the eggs have been fried
in butter with salt and pepper and now they are carefully placed on
the ham.
Remarks: You need not put the ham into the milk and instead
of ham you may take breakfast bacon. (Bacon and Eggs).
Preparation: The ham is cut into ¼ inch thick slices and put
into milk for 5 hours, then taken out, dried, salted, dipped into white
of egg and then into roll crumbs mixed with the flour. Then it is fried
in hot butter on both sides. These ham slices are nice to serve with
vegetables.
For Stuffing.
Preparation: The skin and fat are removed from the fillets and
these pounded flat. Chopped pork and veal, eggs, ½ tablespoonful
of butter, lemon juice, capers, salt and pepper are mixed well. This
stuffing is placed between two fillets and these are then tied
together with string or fastened together with toothpicks. If there
are four fillets, put ½ of the stuffing on two and place the other two
on top, then put bacon strips on top and fry them like No. 15, 1 to
1½ hours. Strain the gravy and serve with the fillets. This makes a
very fine dish.
No. 17—ROASTED PORK CUTLETS.
Quantity for 6 Persons.
Preparation: The fat is cut off and the cutlets salted and
peppered and dipped in flour, then fried quickly in hot butter on both
sides. They are then taken out and put on a hot platter. The sliced
onion and flour are browned in the drippings, bouillon, wine, spices,
lemon juice, salt, 4 pepper-corns added, and cooked a while. The
cutlets are then put into this gravy, covered and placed into the oven
to stew one hour. When done, strain the gravy and serve with cutlets
on the same platter.
The Stuffing.
Extra.
Preparation: The pork ribs which have been salted for several
days are cut into pieces, washed, dried and fried on both sides in
hot butter, then put into a pot, the sauerkraut on top. (If the
sauerkraut is too sour, soak it in water and drain). Add ¼ lb. of
butter, apples, white wine and sugar, cover and cook slowly for 2
hours. When it gets too dry, pour in some water.
The Meat Dumplings: The chopped pork and veal, soaked roll,
egg, 1 tablespoonful of butter and onion are mixed well. Shape into
dumplings and fry well done in the butter in which you fried the ribs.
Arrange the sauerkraut in the middle of the platter, the ribs
around it and the dumplings piled on top in a heap. Then serve. If
you cannot get wine, omit it.
No. 25—SAUSAGE.
Quantity for 6 Persons.
No. 27—SAUSAGES.
Quantity for 6 Persons.
1 lb. of sausages
2 whites of eggs
1 cup of grated rolls
Salt, drippings or butter
½ cup of flour
1 suckling pig
Salt
½ lb. of butter
¾ pt. of water
1 pinch of pepper
1 suckling pig
2 lbs. of sweet-sour apples
1 cup of dried currants
1 tbsp. of sugar
Salt
½ lb. of butter
½ cup seedless raisins
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookgate.com