<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="generator" content="pdf2htmlEX">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css">
<link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css">
<link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/625d1dfebe9ad24cfa794da0/raw.css">
<script src="https://static.pudn.com/base/js/compatibility.min.js"></script>
<script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script>
<script>
try{
pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({});
}catch(e){}
</script>
<title></title>
</head>
<body>
<div id="sidebar" style="display: none">
<div id="outline">
</div>
</div>
<div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/625d1dfebe9ad24cfa794da0/bg1.jpg"><div class="t m0 x1 h2 y1 ff1 fs0 fc0 sc0 ls0 ws0">11</div><div class="t m0 x2 h3 y2 ff1 fs1 fc0 sc0 ls1 ws0">CHAPTER</div><div class="t m0 x3 h4 y3 ff1 fs2 fc0 sc0 ls2 ws0">2</div><div class="t m0 x4 h5 y4 ff2 fs3 fc0 sc0 ls3 ws1">Statistics, Probability and Noise</div><div class="t m0 x5 h6 y5 ff1 fs4 fc0 sc0 ls4 ws2">Statistics and probability are used in Digital Signal Processing to characterize signals and the</div><div class="t m0 x5 h6 y6 ff1 fs4 fc0 sc0 ls5 ws3">processes that generate them. For example, a primary use of DSP is to reduce interference, noise,</div><div class="t m0 x5 h6 y7 ff1 fs4 fc0 sc0 ls6 ws4">and other undesirable components in acquired data. These may be an inherent part of the signal</div><div class="t m0 x5 h6 y8 ff1 fs4 fc0 sc0 ls7 ws5">being measured, arise from imperfections in the data acquisition system, or be introduced as an</div><div class="t m0 x5 h6 y9 ff1 fs4 fc0 sc0 ls8 ws6">unavoidable byproduct of some DSP operation. Statistics and probability allow these disruptive</div><div class="t m0 x5 h6 ya ff1 fs4 fc0 sc0 ls9 ws7">features to be measured and classified, the first step in developing strategies to remove the</div><div class="t m0 x5 h6 yb ff1 fs4 fc0 sc0 lsa ws8">offending components. This chapter introduces the most important concepts in statistics and</div><div class="t m0 x5 h6 yc ff1 fs4 fc0 sc0 lsb ws9">probability, with emphasis on how they apply to acquired signals. </div><div class="t m0 x5 h7 yd ff2 fs5 fc0 sc0 lsc wsa">Signal and Graph Terminology</div><div class="t m0 x6 h8 ye ff1 fs6 fc0 sc0 lsd wsb">A <span class="ff3 lse ws0">signal</span><span class="lsf wsc"> is a description of how one parameter is related to another parameter.</span></div><div class="t m0 x6 h8 yf ff1 fs6 fc0 sc0 ls10 wsd">For example, the most common type of signal in analog electronics is a <span class="ff3 ls11 ws0">voltage</span></div><div class="t m0 x6 h8 y10 ff1 fs6 fc0 sc0 ls12 wse">that varies with <span class="ff3 ls13 ws0">time</span><span class="ls14 wsf">. Since both parameters can assume a continuous range</span></div><div class="t m0 x6 h9 y11 ff1 fs6 fc0 sc0 ls15 ws10">of values, we will call this a <span class="ff4 ls16 ws11">continuous signal</span><span class="ls17 ws12">. In comparison, passing this</span></div><div class="t m0 x6 h8 y12 ff1 fs6 fc0 sc0 ls18 ws13">signal through an analog-to-digital converter forces each of the two parameters</div><div class="t m0 x6 h8 y13 ff1 fs6 fc0 sc0 ls19 ws14">to be <span class="ff3 ls1a ws0">quantized</span><span class="ls1b ws15">. For instance, imagine the conversion being done with 12 bits</span></div><div class="t m0 x6 h8 y14 ff1 fs6 fc0 sc0 ls1c ws16">at a sampling rate of 1000 samples per second. The voltage is curtailed to 4096</div><div class="t m0 x6 h8 y15 ff1 fs6 fc0 sc0 ls1d ws0">(2</div><div class="t m0 x7 ha y16 ff1 fs7 fc0 sc0 ls1e ws0">12</div><div class="t m0 x8 h8 y15 ff1 fs6 fc0 sc0 ls1f ws17">) possible binary levels, and the time is only defined at one millisecond</div><div class="t m0 x6 h8 y17 ff1 fs6 fc0 sc0 ls20 ws18">increments. Signals formed from parameters that are quantized in this manner</div><div class="t m0 x6 h9 y18 ff1 fs6 fc0 sc0 ls21 ws19">are said to be <span class="ff4 ls22 ws1a">discrete signals</span><span class="ls23 ws1b"> or <span class="ff4 ls24 ws1c">digitized signals</span><span class="ls25 ws1d">. For the most part,</span></span></div><div class="t m0 x6 h8 y19 ff1 fs6 fc0 sc0 ls26 ws1e">continuous signals exist in nature, while discrete signals exist inside computers</div><div class="t m0 x6 h8 y1a ff1 fs6 fc0 sc0 ls27 ws1f">(although you can find exceptions to both cases). It is also possible to have</div><div class="t m0 x6 h8 y1b ff1 fs6 fc0 sc0 ls28 ws20">signals where one parameter is continuous and the other is discrete. Since</div><div class="t m0 x6 h8 y1c ff1 fs6 fc0 sc0 ls29 ws21">these mixed signals are quite uncommon, they do not have special names given</div><div class="t m0 x6 h8 y1d ff1 fs6 fc0 sc0 ls2a ws22">to them, and the nature of the two parameters must be explicitly stated.</div><div class="t m0 x6 h8 y1e ff1 fs6 fc0 sc0 ls2b ws23">Figure 2-1 shows two discrete signals, such as might be acquired with a</div><div class="t m0 x6 h9 y1f ff1 fs6 fc0 sc0 ls2c ws24">digital data acquisition system. The <span class="ff4 ls2d ws25">vertical axis</span><span class="ls2e ws26"> may represent voltage, light</span></div></div><div class="pi" data-data='{"ctm":[1.839080,0.000000,0.000000,1.839080,0.000000,0.000000]}'></div></div>
</body>
</html>
<div id="pf2" class="pf w0 h0" data-page-no="2"><div class="pc pc2 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/625d1dfebe9ad24cfa794da0/bg2.jpg"><div class="t m0 x9 h2 y20 ff3 fs0 fc0 sc0 ls2f ws27">The Scientist and Engineer's Guide to Digital Signal Processing<span class="_ _0"></span><span class="ff1 ls0 ws0">12</span></div><div class="t m0 xa h8 y21 ff1 fs6 fc0 sc0 ls30 ws28">intensity, sound pressure, or an infinite number of other parameters. Since we</div><div class="t m0 xa h8 y22 ff1 fs6 fc0 sc0 ls31 ws29">don't know what it represents in this particular case, we will give it the generic</div><div class="t m0 xa h9 y23 ff1 fs6 fc0 sc0 ls32 ws2a">label: <span class="ff4 ls33 ws0">amplitude</span><span class="ls34 ws2b">. This parameter is also called several other names: the <span class="ff4 ls35 ws0">y-</span></span></div><div class="t m0 xa h9 y24 ff4 fs6 fc0 sc0 ls36 ws0">axis<span class="ff1 ls19 ws2c">, the </span><span class="ls37 ws2d">dependent variable<span class="ff1 ls19 ws2c">, the </span></span><span class="ls38">range<span class="ff1 ls39 ws2e">, and the </span><span class="ls3a">ordinate<span class="ff1 ls1e ws2f">. </span></span></span></div><div class="t m0 xa h9 y25 ff1 fs6 fc0 sc0 ls3b ws30">The <span class="ff4 ls3c ws31">horizontal axis</span><span class="ls3d ws32"> represents the other parameter of the signal, going by</span></div><div class="t m0 xa h9 y26 ff1 fs6 fc0 sc0 ls3e ws33">such names as: the <span class="ff4 ls3f ws0">x-axis</span><span class="ls19 ws34">, the <span class="ff4 ls40 ws35">independent variable</span>, the <span class="ff4 ls41 ws0">domain</span><span class="ls39 ws36">, and the</span></span></div><div class="t m0 xa h9 y27 ff4 fs6 fc0 sc0 ls42 ws0">abscissa<span class="ff1 ls43 ws2f">. <span class="ff3 ws0">Time</span><span class="ls44 ws37"> is the most common parameter to appear on the horizontal axis</span></span></div><div class="t m0 xa h8 y28 ff1 fs6 fc0 sc0 ls45 ws38">of acquired signals; however, other parameters are used in specific applications.</div><div class="t m0 xa h8 y29 ff1 fs6 fc0 sc0 ls46 ws39">For example, a geophysicist might acquire measurements of rock density at</div><div class="t m0 xa h8 y2a ff1 fs6 fc0 sc0 ls47 ws3a">equally spaced <span class="ff3 ls48 ws0">distances</span><span class="ls49 ws3b"> along the surface of the earth. To keep things</span></div><div class="t m0 xa h9 y2b ff1 fs6 fc0 sc0 ls4a ws3c">general, we will simply label the horizontal axis: <span class="ff4 ls4b ws3d">sample number</span><span class="ls4c ws3e">. If this</span></div><div class="t m0 xa h8 y2c ff1 fs6 fc0 sc0 ls4d ws3f">were a continuous signal, another label would have to be used, such as: <span class="ff3 ls13 ws0">time<span class="ff1 ls1e">,</span></span></div><div class="t m0 xa h8 y2d ff3 fs6 fc0 sc0 ls4e ws0">distance<span class="ff1 ls1e ws2f">, </span><span class="ls4f">x<span class="ff1 ls50 ws40">, etc. </span></span></div><div class="t m0 xa h8 y2e ff1 fs6 fc0 sc0 ls51 ws41">The two parameters that form a signal are generally not interchangeable. The</div><div class="t m0 xa h9 y2f ff1 fs6 fc0 sc0 ls52 ws42">parameter on the y-axis (the dependent variable) is said to be a <span class="ff4 ls53 ws0">function</span><span class="ls54 ws43"> of the</span></div><div class="t m0 xa h8 y30 ff1 fs6 fc0 sc0 ls55 ws44">parameter on the x-axis (the independent variable). In other words, the</div><div class="t m0 xa h8 y31 ff1 fs6 fc0 sc0 ls56 ws45">independent variable describes <span class="ff3 ls57 ws0">how</span><span class="ls23 ws46"> or <span class="ff3 ls58 ws0">when</span><span class="ls59 ws47"> each sample is taken, while the</span></span></div><div class="t m0 xa h8 y32 ff1 fs6 fc0 sc0 ls5a ws48">dependent variable is the actual measurement. Given a specific value on the</div><div class="t m0 xa h8 y33 ff1 fs6 fc0 sc0 ls5b ws49">x-axis, we can always find the corresponding value on the y-axis, but usually</div><div class="t m0 xa h8 y34 ff1 fs6 fc0 sc0 ls5c ws4a">not the other way around.</div><div class="t m0 xa h8 y35 ff1 fs6 fc0 sc0 ls5d ws4b">Pay particular attention to the word: <span class="ff3 ls1e ws0">domain</span><span class="ls5e ws4c">, a very widely used term in DSP.</span></div><div class="t m0 xa h8 y36 ff1 fs6 fc0 sc0 ls5f ws4d">For instance, a signal that uses time as the independent variable (i.e., the</div><div class="t m0 xa h9 y37 ff1 fs6 fc0 sc0 ls60 ws4e">parameter on the horizontal axis), is said to be in the <span class="ff4 ls61 ws4f">time domain</span><span class="ls62 ws50">. Another</span></div><div class="t m0 xa h8 y38 ff1 fs6 fc0 sc0 ls63 ws51">common signal in DSP uses frequency as the independent variable, resulting in</div><div class="t m0 xa h9 y39 ff1 fs6 fc0 sc0 ls64 ws52">the term, <span class="ff4 ls65 ws53">frequency domain</span><span class="ls66 ws54">. Likewise, signals that use distance as the</span></div><div class="t m0 xa h9 y3a ff1 fs6 fc0 sc0 ls67 ws55">independent parameter are said to be in the <span class="ff4 ls68 ws56">spatial domain</span><span class="ls69 ws57"> (distance is a</span></div><div class="t m0 xa h8 y3b ff1 fs6 fc0 sc0 ls6a ws58">measure of space). The type of parameter on the horizontal axis <span class="ff3 ls6b ws0">is</span><span class="ls6c ws59"> the domain</span></div><div class="t m0 xa h8 y3c ff1 fs6 fc0 sc0 ls6d ws5a">of the signal; it's that simple. What if the x-axis is labeled with something</div><div class="t m0 xa h8 y3d ff1 fs6 fc0 sc0 ls6e ws5b">very generic, such as <span class="ff3 ls6f ws5c">sample number</span><span class="ls70 ws5d">? Authors commonly refer to these signals</span></div><div class="t m0 xa h8 y3e ff1 fs6 fc0 sc0 ls71 ws5e">as being in the <span class="ff3 ls13 ws0">time</span><span class="ls72 ws5f"> domain. This is because sampling at equal intervals of</span></div><div class="t m0 xa h8 y3f ff1 fs6 fc0 sc0 ls73 ws60">time is the most common way of obtaining signals, and they don't have anything</div><div class="t m0 xa h8 y40 ff1 fs6 fc0 sc0 ls74 ws61">more specific to call it. </div><div class="t m0 xa h8 y41 ff1 fs6 fc0 sc0 ls75 ws62">Although the signals in Fig. 2-1 are discrete, they are displayed in this figure</div><div class="t m0 xa h8 y42 ff1 fs6 fc0 sc0 ls76 ws63">as continuous lines. This is because there are too many samples to be</div><div class="t m0 xa h8 y43 ff1 fs6 fc0 sc0 ls77 ws64">distinguishable if they were displayed as individual markers. In graphs that</div><div class="t m0 xa h8 y44 ff1 fs6 fc0 sc0 ls78 ws65">portray shorter signals, say less than 100 samples, the individual markers are</div><div class="t m0 xa h8 y45 ff1 fs6 fc0 sc0 ls79 ws66">usually shown. Continuous lines may or may not be drawn to connect the</div><div class="t m0 xa h8 y46 ff1 fs6 fc0 sc0 ls7a ws67">markers, depending on how the author wants you to view the data. For</div><div class="t m0 xa h8 y47 ff1 fs6 fc0 sc0 ls7b ws68">instance, a continuous line could imply what is happening <span class="ff3 ls7c ws0">between</span><span class="ls7d ws69"> samples, or</span></div><div class="t m0 xa h8 y48 ff1 fs6 fc0 sc0 ls7e ws6a">simply be an aid to help the reader's eye follow a trend in noisy data. The</div><div class="t m0 xa h8 y49 ff1 fs6 fc0 sc0 ls7f ws6b">point is, examine the labeling of the horizontal axis to find if you are working</div><div class="t m0 xa h8 y4a ff1 fs6 fc0 sc0 ls80 ws6c">with a discrete or continuous signal. Don't rely on an illustrator's ability to</div><div class="t m0 xa h8 y4b ff1 fs6 fc0 sc0 ls81 wsf">draw dots.</div><div class="t m0 xa h8 y4c ff1 fs6 fc0 sc0 ls82 ws6d">The variable, <span class="ff5 ls83 ws0">N</span><span class="ls84 ws6e">, is widely used in DSP to represent the total number of</span></div><div class="t m0 xa h8 y4d ff1 fs6 fc0 sc0 ls2c ws6f">samples in a signal. For example, <span class="_ _1"> </span><span class="ls85 ws70"> for the signals in Fig. 2-1. To<span class="_ _2"></span><span class="ff3 fs0 ls86 ws0">N<span class="_ _3"> </span><span class="ff6 ls87">'<span class="_ _4"></span><span class="ff1 ls0">512</span></span></span></span></div></div><div class="pi" data-data='{"ctm":[1.839080,0.000000,0.000000,1.839080,0.000000,0.000000]}'></div></div>
<div id="pf3" class="pf w0 h0" data-page-no="3"><div class="pc pc3 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/625d1dfebe9ad24cfa794da0/bg3.jpg"><div class="t m0 xb h2 y20 ff3 fs0 fc0 sc0 ls88 ws71">Chapter 2- Statistics, Probability and Noise<span class="_ _5"> </span><span class="ff1 ls0 ws0">13</span></div><div class="t m0 x6 hb y4e ff7 fs8 fc0 sc0 ls7c ws72">Sample number</div><div class="t m0 xc hc y4f ff7 fs9 fc0 sc0 ls89 ws0">0<span class="_ _6"> </span>64<span class="_ _7"> </span>128<span class="_ _8"> </span>192<span class="_ _8"> </span>256<span class="_ _8"> </span>320<span class="_ _8"> </span>384<span class="_ _8"> </span>448<span class="_ _8"> </span><span class="fc1 sc0">512</span></div><div class="t m0 xd hc y50 ff7 fs9 fc0 sc0 ls8a ws0">-4</div><div class="t m0 xd hc y51 ff7 fs9 fc0 sc0 ls8a ws0">-2</div><div class="t m0 xe hc y52 ff7 fs9 fc0 sc0 ls89 ws0">0</div><div class="t m0 xe hc y53 ff7 fs9 fc0 sc0 ls89 ws0">2</div><div class="t m0 xe hc y54 ff7 fs9 fc0 sc0 ls89 ws0">4</div><div class="t m0 xe hc y55 ff7 fs9 fc0 sc0 ls89 ws0">6</div><div class="t m0 xe hc y56 ff7 fs9 fc0 sc0 ls89 ws0">8</div><div class="t m0 xf hd y4f ff1 fs9 fc0 sc0 ls43 ws0">511</div><div class="t m0 x10 he y57 ff1 fs8 fc0 sc0 ls8b ws73">a. Mean = 0.5, <span class="ff8 ls8c ws0">F</span><span class="ls8d ws74"> = 1</span></div><div class="t m0 x11 he y4e ff1 fs8 fc0 sc0 ls8e ws75">Sample number</div><div class="t m0 x12 hd y58 ff1 fs9 fc0 sc0 ls43 ws0">0<span class="_ _6"> </span>64<span class="_ _7"> </span>128<span class="_ _8"> </span>192<span class="_ _8"> </span>256<span class="_ _8"> </span>320<span class="_ _8"> </span>384<span class="_ _8"> </span>448<span class="_ _8"> </span><span class="fc1 sc0">512</span></div><div class="t m0 x13 hd y50 ff1 fs9 fc0 sc0 ls8f ws0">-4</div><div class="t m0 x13 hd y51 ff1 fs9 fc0 sc0 ls8f ws0">-2</div><div class="t m0 x14 hd y27 ff1 fs9 fc0 sc0 ls43 ws0">0</div><div class="t m0 x14 hd y53 ff1 fs9 fc0 sc0 ls43 ws0">2</div><div class="t m0 x14 hd y54 ff1 fs9 fc0 sc0 ls43 ws0">4</div><div class="t m0 x14 hd y55 ff1 fs9 fc0 sc0 ls43 ws0">6</div><div class="t m0 x14 hd y59 ff1 fs9 fc0 sc0 ls43 ws0">8</div><div class="t m0 x15 hd y58 ff1 fs9 fc0 sc0 ls43 ws0">511</div><div class="t m0 x16 he y5a ff1 fs8 fc0 sc0 ls90 ws76">b. Mean = 3.0, <span class="ff8 ls8c ws0">F</span><span class="ls91 ws77"> = 0.2</span></div><div class="t m1 x17 hf y5b ff1 fsa fc0 sc0 ls43 ws0">Amplitude</div><div class="t m1 x18 hf y5b ff1 fsa fc0 sc0 ls43 ws0">Amplitude</div><div class="t m0 x19 h10 y5c ff1 fsb fc0 sc0 ls92 ws78">FIGURE 2-1</div><div class="t m0 x19 h10 y5d ff1 fsb fc0 sc0 ls93 ws79">Examples of two digitized signals with different means and standard deviations<span class="fsc ls94 ws0">.</span></div><div class="t m0 x5 h10 y5e ff1 fsb fc0 sc0 ls95 ws7a">EQUATION 2-1</div><div class="t m0 x5 h10 y5f ff1 fsb fc0 sc0 ls96 ws7b">Calculation of a signal's mean. The signal is</div><div class="t m0 x5 h10 y60 ff1 fsb fc0 sc0 ls97 ws7c">contained in <span class="ff3 ls98 ws0">x</span></div><div class="t m0 x1a h11 y43 ff1 fsd fc0 sc0 ls43 ws0">0</div><div class="t m0 x1b h10 y60 ff1 fsb fc0 sc0 ls99 ws7d"> through <span class="ff3 ls98 ws0">x</span></div><div class="t m0 x6 h11 y43 ff3 fsd fc0 sc0 ls9a ws0">N<span class="ff1 ls9b">-1</span></div><div class="t m0 x1c h10 y60 ff1 fsb fc0 sc0 ls9c ws7e">, <span class="ff3 ls9d ws0">i</span><span class="ls9e ws7f"> is an index that</span></div><div class="t m0 x5 h10 y61 ff1 fsb fc0 sc0 ls9f ws80">runs through these values, and µ is the mean.</div><div class="t m0 x1d h12 y62 ff1 fse fc0 sc0 lsa0 ws0">µ<span class="_ _9"> </span><span class="ff6 lsa1">'</span></div><div class="t m0 x1e h13 y63 ff1 fsf fc0 sc0 ls43 ws0">1</div><div class="t m0 x1f h14 y64 ff3 fsf fc0 sc0 lsa2 ws0">N</div><div class="t m0 x20 h15 y65 ff9 fse fc0 sc0 lsa3 ws0">j</div><div class="t m0 x21 hf y66 ff3 fsa fc0 sc0 lsa4 ws0">N<span class="_ _a"> </span><span class="ff6 lsa5">&<span class="ff1 ls0">1</span></span></div><div class="t m0 x22 hf y67 ff3 fsa fc0 sc0 ls6b ws0">i<span class="_"> </span><span class="ff6 lsa5">'<span class="_ _4"></span><span class="ff1 ls0">0</span></span></div><div class="t m0 x23 h16 y62 ff3 fse fc0 sc0 lsa6 ws0">x</div><div class="t m0 x24 h17 y68 ff3 fsa fc0 sc0 ls6b ws0">i</div><div class="t m0 x6 h9 y31 ff1 fs6 fc0 sc0 lsa7 ws81">keep the data organized, each sample is assigned a <span class="ff4 ls4b ws82">sample number</span><span class="lsa8 ws83"> or</span></div><div class="t m0 x6 h9 y32 ff4 fs6 fc0 sc0 lsa9 ws0">index<span class="ff1 lsaa ws84">. These are the numbers that appear along the horizontal axis. Two</span></div><div class="t m0 x6 h8 y33 ff1 fs6 fc0 sc0 lsab ws85">notations for assigning sample numbers are commonly used. In the first</div><div class="t m0 x6 h8 y34 ff1 fs6 fc0 sc0 lsac ws86">notation, the sample indexes run from 1 to <span class="ff3 lsad ws87">N </span><span class="lsae ws88"> (e.g., 1 to 512). In the second</span></div><div class="t m0 x6 h8 y69 ff1 fs6 fc0 sc0 lsaf ws89">notation, the sample indexes run from 0 to <span class="_ _b"> </span><span class="lsb0 ws8a"> (e.g., 0 to 511).<span class="_ _c"></span><span class="ff3 fs0 ls86 ws0">N<span class="_ _d"></span><span class="ff6 ls87">&<span class="_ _4"></span><span class="ff1 ls0">1</span></span></span></span></div><div class="t m0 x6 h8 y35 ff1 fs6 fc0 sc0 lsb1 ws8b">Mathematicians often use the first method (1 to <span class="ff3 lsad ws0">N</span><span class="lsb2 ws8c">), while those in DSP</span></div><div class="t m0 x6 h8 y36 ff1 fs6 fc0 sc0 lsb3 ws8d">commonly uses the second (0 to <span class="_ _b"> </span><span class="lsb4 ws8e">). In this book, we will use the second<span class="_ _e"></span><span class="ff3 fs0 ls86 ws0">N<span class="_ _d"></span><span class="ff6 ls87">&<span class="_ _4"></span><span class="ff1 ls0">1</span></span></span></span></div><div class="t m0 x6 h8 y37 ff1 fs6 fc0 sc0 lsb5 ws8f">notation. Don't dismiss this as a trivial problem. It <span class="ff3 lsb6 ws0">will</span><span class="lsb7 ws90"> confuse you</span></div><div class="t m0 x6 h8 y38 ff1 fs6 fc0 sc0 lsb8 ws91">sometime during your career. Look out for it!</div><div class="t m0 x5 h7 y3b ff2 fs5 fc0 sc0 lsb9 ws92">Mean and Standard Deviation</div><div class="t m0 x6 h9 y3d ff1 fs6 fc0 sc0 lsba ws93">The <span class="ff4 lsbb ws0">mean</span><span class="ls19 ws14">, indicated by <span class="ff4 lsbc ws0">µ</span><span class="lsbd ws94"> (a lower case Greek <span class="ff3 lsbe ws0">mu</span><span class="lsbf ws95">), is the statistician's jargon</span></span></span></div><div class="t m0 x6 h8 y3e ff1 fs6 fc0 sc0 lsc0 ws96">for the average value of a signal. It is found just as you would expect: add all</div><div class="t m0 x6 h8 y3f ff1 fs6 fc0 sc0 lsc1 ws97">of the samples together, and divide by <span class="ff3 lsc2 ws0">N</span><span class="lsc3 ws98">. It looks like this in mathematical</span></div><div class="t m0 x6 h8 y40 ff1 fs6 fc0 sc0 lsc4 ws0">form:</div><div class="t m0 x6 h8 y48 ff1 fs6 fc0 sc0 lsc5 ws99">In words, sum the values in the signal, <span class="_ _8"> </span><span class="lsc6 ws9a">, by letting the index, <span class="ff3 lsc7 ws0">i</span><span class="lsc8 ws9b">, run from 0<span class="_ _f"></span><span class="ff3 fs0 lsc9 ws0">x</span></span></span></div><div class="t m0 x25 h18 y6a ff3 fs9 fc0 sc0 lsca ws0">i</div><div class="t m0 x6 h8 y49 ff1 fs6 fc0 sc0 lscb ws9c">to <span class="_ _b"> </span><span class="lscc ws9d">. Then finish the calculation by dividing the sum by <span class="ff3 lsad ws0">N</span><span class="lscd ws9e">. This is<span class="_ _10"></span><span class="ff3 fs0 ls86 ws0">N<span class="_ _d"></span><span class="ff6 ls87">&<span class="_ _4"></span><span class="ff1 ls0">1</span></span></span></span></span></div><div class="t m0 x6 h8 y4a ff1 fs6 fc0 sc0 lsce ws9f">identical to the equation: <span class="_ _11"> </span><span class="lscf wsa0">. If you are not already<span class="_ _12"></span><span class="fs0 lsd ws0">µ<span class="_ _13"> </span><span class="ff6 ls87">'<span class="_ _14"> </span></span><span class="lsd0">(<span class="ff3 lsc9">x</span></span></span></span></div><div class="t m0 x26 hd y6b ff1 fs9 fc0 sc0 ls43 ws0">0</div><div class="t m0 x17 h19 y4a ff6 fs0 fc0 sc0 ls87 ws0">%<span class="_ _4"></span><span class="ff3 lsc9">x</span></div><div class="t m0 x27 hd y6b ff1 fs9 fc0 sc0 ls43 ws0">1</div><div class="t m0 x28 h19 y4a ff6 fs0 fc0 sc0 ls87 ws0">%<span class="_ _d"> </span><span class="ff3 lsc9">x</span></div><div class="t m0 x20 hd y6b ff1 fs9 fc0 sc0 ls43 ws0">2</div><div class="t m0 x29 h19 y4a ff6 fs0 fc0 sc0 ls87 ws0">%<span class="_ _4"></span><span class="ffa lsd1">þ<span class="_ _d"> </span></span>%<span class="_ _d"> </span><span class="ff3 lsc9">x</span></div><div class="t m0 x2a hd y6b ff3 fs9 fc0 sc0 lsd2 ws0">N<span class="_ _4"></span><span class="ff6 lsa5">&<span class="ff1 ls43">1</span></span></div><div class="t m0 x2b h2 y4a ff1 fs0 fc0 sc0 lsd0 ws0">)<span class="_ _d"></span><span class="lsd3">/<span class="ff3 ls86">N</span></span></div><div class="t m0 x6 h8 y4b ff1 fs6 fc0 sc0 lsd4 wsa1">familiar with <span class="ff8 fsb lsd5 ws0">E</span><span class="lsd6 wsa2"> (upper case Greek <span class="ff3 lsd7 ws0">sigma</span><span class="ls30 wsa3">) being used to indicate <span class="ff3 ls1a ws0">summation<span class="ff1 ls1e">,</span></span></span></span></div><div class="t m0 x6 h8 y6c ff1 fs6 fc0 sc0 lsd8 wsa4">study these equations carefully, and compare them with the computer program</div><div class="t m0 x6 h8 y4c ff1 fs6 fc0 sc0 lsd9 wsa5">in Table 2-1. Summations of this type are abundant in DSP, and you need to</div><div class="t m0 x6 h8 y4d ff1 fs6 fc0 sc0 ls0 wsa6">understand this notation fully.</div></div><div class="pi" data-data='{"ctm":[1.839080,0.000000,0.000000,1.839080,0.000000,0.000000]}'></div></div>
<div id="pf4" class="pf w0 h0" data-page-no="4"><div class="pc pc4 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/625d1dfebe9ad24cfa794da0/bg4.jpg"><div class="t m0 x9 h2 y20 ff3 fs0 fc0 sc0 ls2f ws27">The Scientist and Engineer's Guide to Digital Signal Processing<span class="_ _0"></span><span class="ff1 ls0 ws0">14</span></div><div class="t m0 x2c h10 y6d ff1 fsb fc0 sc0 ls95 ws7a">EQUATION 2-2</div><div class="t m0 x2c h10 y6e ff1 fsb fc0 sc0 lsda wsa7">Calculation of the standard deviation of a</div><div class="t m0 x2c h10 y6f ff1 fsb fc0 sc0 lsdb wsa8">signal. The signal is stored in <span class="_ _15"> </span><span class="lsdc wsa9">, µ is the<span class="_ _16"></span><span class="ff3 fsc lsdd ws0">x</span></span></div><div class="t m0 x2d h1a y70 ff3 fs10 fc0 sc0 lsde ws0">i</div><div class="t m0 x2c h10 y3f ff1 fsb fc0 sc0 lsdf wsaa">mean found from Eq. 2-1, <span class="ff3 lse0 ws0">N</span><span class="lse1 wsab"> is the number of</span></div><div class="t m0 x2c h10 y71 ff1 fsb fc0 sc0 ls15 wsac">samples, and <span class="_ _8"> </span><span class="ls43 wsad"> <span class="lse2 wsae">is the standard deviation.</span></span></div><div class="c x2e y72 w2 h1b"><div class="t m0 x2f h1c y73 ffb fsc fc0 sc0 lse3 ws0">σ</div></div><div class="t m0 x30 h1d y6f ff8 fse fc0 sc0 lse4 ws0">F</div><div class="t m0 x31 hf y74 ff1 fsa fc0 sc0 ls0 ws0">2</div><div class="t m0 x32 h1d y6f ff6 fse fc0 sc0 lsa1 ws0">'</div><div class="t m0 x33 h13 y75 ff1 fsf fc0 sc0 ls43 ws0">1</div><div class="t m0 x34 h1d y76 ff3 fsf fc0 sc0 lsa2 ws0">N<span class="_ _d"></span><span class="ff6 fse lsa1">&</span><span class="ff1 ls43">1</span></div><div class="t m0 x1f h15 y77 ff9 fse fc0 sc0 lsa3 ws0">j</div><div class="t m0 x35 hf y78 ff3 fsa fc0 sc0 lsa4 ws0">N<span class="_ _a"> </span><span class="ff6 lsa5">&<span class="ff1 ls0">1</span></span></div><div class="t m0 x36 hf y79 ff3 fsa fc0 sc0 ls6b ws0">i<span class="_"> </span><span class="ff6 lsa5">'<span class="_ _4"></span><span class="ff1 ls0">0</span></span></div><div class="t m0 x21 h12 y6f ff1 fse fc0 sc0 lse5 ws0">(<span class="ff3 lsa6">x</span></div><div class="t m0 x37 h17 y7a ff3 fsa fc0 sc0 ls6b ws0">i</div><div class="t m0 x38 h12 y6f ff6 fse fc0 sc0 lsa1 ws0">&<span class="_ _14"> </span><span class="ff1 lsa0">µ<span class="_ _14"> </span><span class="lse5">)</span></span></div><div class="t m0 x39 hf y74 ff1 fsa fc0 sc0 ls0 ws0">2</div><div class="t m0 xa h9 y21 ff1 fs6 fc0 sc0 ls39 wsaf">In electronics, the <span class="ff3 ls1d ws0">mean</span><span class="lse6 wsb0"> is commonly called the <span class="ff4 lse7 ws0">DC</span><span class="ls7 wsb1"> (direct current) value.</span></span></div><div class="t m0 xa h9 y22 ff1 fs6 fc0 sc0 lse8 wsb2">Likewise, <span class="ff4 lse7 ws0">AC</span><span class="lse9 wsb3"> (alternating current) refers to how the signal fluctuates around</span></div><div class="t m0 xa h8 y23 ff1 fs6 fc0 sc0 lsea wsb4">the mean value. If the signal is a simple repetitive waveform, such as a sine</div><div class="t m0 xa h8 y24 ff1 fs6 fc0 sc0 lseb wsb5">or square wave, its excursions can be described by its peak-to-peak amplitude.</div><div class="t m0 xa h8 y7b ff1 fs6 fc0 sc0 lsec wsb6">Unfortunately, most acquired signals do not show a well defined peak-to-peak</div><div class="t m0 xa h8 y25 ff1 fs6 fc0 sc0 lsed wsb7">value, but have a random nature, such as the signals in Fig. 2-1. A more</div><div class="t m0 xa h9 y26 ff1 fs6 fc0 sc0 lsee wsb8">generalized method must be used in these cases, called the <span class="ff4 lsef ws0">standard</span></div><div class="t m0 xa h1e y27 ff4 fs6 fc0 sc0 lsf0 ws0">deviation<span class="ff1 lsf1 wsb9">, denoted by<span class="fs5 ls43 wsba"> </span></span><span class="ffc fsf lsf2">F<span class="_ _17"></span>F<span class="ff1 fs5 ls43 wsba"> <span class="fs6 lsbd wsbb">(a lower case Greek <span class="ff3 lsd7 ws0">sigma<span class="ff1 ls1d">).</span></span></span></span></span></div><div class="t m0 xa h8 y29 ff1 fs6 fc0 sc0 lse9 wsbc">As a starting point, the expression,<span class="_ _18"> </span><span class="lsf3 wsbd">, describes how far the <span class="_ _7"> </span><span class="ls13 wsbe"> sample<span class="_ _19"></span><span class="ffa fs0 lsf4 ws0">*<span class="ff3 lsc9">x</span></span></span></span></div><div class="t m0 x3a h18 y7c ff3 fs9 fc0 sc0 lsca ws0">i</div><div class="t m0 x3b h2 y29 ff6 fs0 fc0 sc0 ls87 ws0">&<span class="_ _d"> </span><span class="ff1 lsd">µ<span class="_ _4"></span><span class="ffa lsf4">*<span class="_ _1a"> </span><span class="ff3 lsd3">i</span></span></span></div><div class="t m0 x3c h18 y7d ff3 fs9 fc0 sc0 lsf5 ws0">th</div><div class="t m0 xa h8 y2a ff3 fs6 fc0 sc0 lsf6 ws0">deviates<span class="ff1 lsf7 wsbf"> (differs) from the mean. The </span><span class="lsf8 wsc0">average deviation<span class="ff1 lsf9 wsc1"> of a signal is found</span></span></div><div class="t m0 xa h8 y2b ff1 fs6 fc0 sc0 lsfa wsc2">by summing the deviations of all the individual samples, and then dividing by</div><div class="t m0 xa h8 y2c ff1 fs6 fc0 sc0 lsfb wsc3">the number of samples, <span class="ff3 lsfc ws0">N.</span><span class="lsfd wsc4"> Notice that we take the absolute value of each</span></div><div class="t m0 xa h8 y2d ff1 fs6 fc0 sc0 lsfe wsc5">deviation before the summation; otherwise the positive and negative terms</div><div class="t m0 xa h8 y7e ff1 fs6 fc0 sc0 lsff wsc6">would average to zero. The average deviation provides a single number</div><div class="t m0 xa h8 y2e ff1 fs6 fc0 sc0 ls100 wsc7">representing the typical distance that the samples are from the mean. While</div><div class="t m0 xa h8 y2f ff1 fs6 fc0 sc0 ls101 wsc8">convenient and straightforward, the average deviation is almost never used in</div><div class="t m0 xa h8 y30 ff1 fs6 fc0 sc0 ls102 wsc9">statistics. This is because it doesn't fit well with the physics of how signals</div><div class="t m0 xa h8 y31 ff1 fs6 fc0 sc0 ls103 wsca">operate. In most cases, the important parameter is not the <span class="ff3 ls104 ws0">deviation</span><span class="ls105 wscb"> from the</span></div><div class="t m0 xa h8 y32 ff1 fs6 fc0 sc0 ls106 wscc">mean, but the <span class="ff3 ls107 ws0">power</span><span class="ls108 wscd"> represented by the deviation from the mean. For example,</span></div><div class="t m0 xa h8 y33 ff1 fs6 fc0 sc0 ls109 wsce">when random noise signals combine in an electronic circuit, the resultant noise</div><div class="t m0 xa h8 y34 ff1 fs6 fc0 sc0 ls7e wscf">is equal to the combined <span class="ff3 ls107 ws0">power</span><span class="ls10a wsd0"> of the individual signals, not their combined</span></div><div class="t m0 xa h8 y69 ff3 fs6 fc0 sc0 ls1e ws0">amplitude<span class="ff1 ws2f">. </span></div><div class="t m0 xa h8 y36 ff1 fs6 fc0 sc0 ls10b wsd1">The <span class="ff3 ls10c wsd2">standard deviation</span><span class="ls10d wsd3"> is similar to the <span class="ff3 ls10e wsd4">average deviation</span><span class="ls10f wsd5">, except the</span></span></div><div class="t m0 xa h8 y37 ff1 fs6 fc0 sc0 ls110 wsd6">averaging is done with power instead of amplitude. This is achieved by</div><div class="t m0 xa h8 y38 ff1 fs6 fc0 sc0 ls111 wsd7">squaring each of the deviations before taking the average (remember, power <span class="ffa fs1 ls88 ws0">%</span></div><div class="t m0 xa h8 y39 ff1 fs6 fc0 sc0 ls112 ws0">voltage</div><div class="t m0 x3d h1f y7f ff1 fs11 fc0 sc0 ls1e ws0">2</div><div class="t m0 x4 h8 y39 ff1 fs6 fc0 sc0 ls113 wsd8">). To finish, the <span class="ff3 ls114 wsd9">square root </span><span class="ls30 wsda">is taken to compensate for the initial</span></div><div class="t m0 xa h8 y3a ff1 fs6 fc0 sc0 ls115 wsdb">squaring. In equation form, the standard deviation is calculated:</div><div class="t m0 xa h8 y42 ff1 fs6 fc0 sc0 ls116 wsb8">In the alternative notation: <span class="_ _1b"> </span><span class="ls1e ws0">.<span class="_ _1c"></span><span class="ff8 fs0 ls117">F<span class="_ _14"> </span><span class="ff6 ls87">'<span class="_ _15"> </span><span class="ff1 lsd0">(<span class="ff3 lsc9">x</span></span></span></span></span></div><div class="t m0 x3e hd y80 ff1 fs9 fc0 sc0 ls43 ws0">0</div><div class="t m0 x36 h2 y42 ff6 fs0 fc0 sc0 ls87 ws0">&<span class="_ _d"> </span><span class="ff1 lsd">µ<span class="_ _4"></span><span class="lsd0">)</span></span></div><div class="t m0 x3f hd y81 ff1 fs9 fc0 sc0 ls43 ws0">2</div><div class="t m0 x40 h2 y42 ff6 fs0 fc0 sc0 ls87 ws0">%<span class="_ _d"> </span><span class="ff1 lsd0">(<span class="ff3 lsc9">x</span></span></div><div class="t m0 x41 hd y80 ff1 fs9 fc0 sc0 ls43 ws0">1</div><div class="t m0 x24 h2 y42 ff6 fs0 fc0 sc0 ls87 ws0">&<span class="_ _4"></span><span class="ff1 lsd">µ<span class="_ _d"></span><span class="lsd0">)</span></span></div><div class="t m0 x42 hd y81 ff1 fs9 fc0 sc0 ls43 ws0">2</div><div class="t m0 x43 h2 y42 ff6 fs0 fc0 sc0 ls87 ws0">%<span class="_ _4"></span><span class="ffa lsd1">þ<span class="_ _d"> </span></span>%<span class="_ _d"> </span><span class="ff1 lsd0">(<span class="ff3 lsc9">x</span></span></div><div class="t m0 x44 hd y80 ff3 fs9 fc0 sc0 lsd2 ws0">N<span class="_ _4"></span><span class="ff6 lsa5">&<span class="ff1 ls43">1</span></span></div><div class="t m0 x45 h2 y42 ff6 fs0 fc0 sc0 ls87 ws0">&<span class="_ _d"> </span><span class="ff1 lsd">µ<span class="_ _4"></span><span class="lsd0">)</span></span></div><div class="t m0 x3c hd y81 ff1 fs9 fc0 sc0 ls43 ws0">2</div><div class="t m0 x46 h2 y42 ff1 fs0 fc0 sc0 lsd3 ws0">/<span class="_ _14"> </span><span class="lsd0">(<span class="ff3 ls86">N<span class="_ _4"></span><span class="ff6 ls87">&</span></span><span class="ls0">1</span>)</span></div><div class="t m0 xa h8 y43 ff1 fs6 fc0 sc0 ls118 wsdc">Notice that the average is carried out by dividing by <span class="_ _b"> </span><span class="lse8 wsdd"> instead of <span class="ff3 lsfc ws0">N.</span><span class="ls119 wsde"> This<span class="_ _1d"></span><span class="ff3 fs0 ls86 ws0">N<span class="_ _d"></span><span class="ff6 ls87">&<span class="_ _4"></span><span class="ff1 ls0">1</span></span></span></span></span></div><div class="t m0 xa h8 y44 ff1 fs6 fc0 sc0 ls115 wsdf">is a subtle feature of the equation that will be discussed in the next section.</div><div class="t m0 xa h8 y45 ff1 fs6 fc0 sc0 ls11a wse0">The term, <span class="ff8 fsb ls11b ws0">F</span></div><div class="t m0 x47 h20 y82 ff1 fs12 fc0 sc0 ls94 ws0">2</div><div class="t m0 x48 h9 y45 ff1 fs6 fc0 sc0 ls118 wse1">, occurs frequently in statistics and is given the name <span class="ff4 ls11c ws0">variance.</span></div><div class="t m0 xa h8 y46 ff1 fs6 fc0 sc0 ls11d wse2">The standard deviation is a measure of how far the signal fluctuates from the</div><div class="t m0 xa h8 y47 ff1 fs6 fc0 sc0 ls11e wse3">mean. The variance represents the power of this fluctuation. Another term</div><div class="t m0 xa h9 y48 ff1 fs6 fc0 sc0 ls11f wse4">you should become familiar with is the <span class="ff4 ls120 wse5">rms (root-mean-square)</span><span class="ls121 wse6"> value,</span></div><div class="t m0 xa h8 y49 ff1 fs6 fc0 sc0 ls122 wse7">frequently used in electronics. By definition, the standard deviation only</div><div class="t m0 xa h8 y4a ff1 fs6 fc0 sc0 ls123 wse8">measures the AC portion of a signal, while the rms value measures both the AC</div><div class="t m0 xa h8 y4b ff1 fs6 fc0 sc0 ls124 wse9">and DC components. If a signal has no DC component, its rms value is</div><div class="t m0 xa h8 y6c ff1 fs6 fc0 sc0 ls125 wsea">identical to its standard deviation. Figure 2-2 shows the relationship between</div><div class="t m0 xa h8 y4c ff1 fs6 fc0 sc0 ls126 wseb">the standard deviation and the peak-to-peak value of several common</div><div class="t m0 xa h8 y4d ff1 fs6 fc0 sc0 ls127 ws0">waveforms.</div></div><div class="pi" data-data='{"ctm":[1.839080,0.000000,0.000000,1.839080,0.000000,0.000000]}'></div></div>
<div id="pf5" class="pf w0 h0" data-page-no="5"><div class="pc pc5 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/625d1dfebe9ad24cfa794da0/bg5.jpg"><div class="t m0 xb h2 y20 ff3 fs0 fc0 sc0 ls88 ws71">Chapter 2- Statistics, Probability and Noise<span class="_ _5"> </span><span class="ff1 ls0 ws0">15</span></div><div class="t m0 x3a h10 y83 ff1 fsb fc0 sc0 ls128 ws0">Vpp</div><div class="t m0 x49 h21 y84 ffd fsb fc0 sc0 ls129 ws0">F</div><div class="t m0 x4a h10 y85 ff1 fsb fc0 sc0 ls128 ws0">Vpp</div><div class="t m0 x30 h21 y86 ffd fsb fc0 sc0 ls129 ws0">F</div><div class="t m0 x3a h10 y85 ff1 fsb fc0 sc0 ls128 ws0">Vpp</div><div class="t m0 x49 h21 y87 ffd fsb fc0 sc0 ls129 ws0">F</div><div class="t m0 x4a h10 y83 ff1 fsb fc0 sc0 ls128 ws0">Vpp</div><div class="t m0 x30 h21 y88 ffd fsb fc0 sc0 ls129 ws0">F</div><div class="t m0 x4b h10 y89 ff1 fsb fc0 sc0 ls92 ws78">FIGURE 2-2</div><div class="t m0 x4b h10 y8a ff1 fsb fc0 sc0 ls12a wsec">Ratio of the peak-to-peak amplitude to the standard deviation for several common waveforms. For the square</div><div class="t m0 x4b h10 y8b ff1 fsb fc0 sc0 ls12b wsed">wave, this ratio is 2; for the triangle wave it is <span class="_ _1e"> </span><span class="ls12c wsee">; for the sine wave it is <span class="_ _1e"> </span><span class="ls12d wsef">. While random<span class="_ _1f"></span><span class="fsc ls43 ws0">12<span class="_ _14"> </span><span class="ffe ls12e">'<span class="_ _13"> </span></span>3<span class="ls0">.</span>46<span class="_ _20"> </span>2<span class="_ _21"> </span>2<span class="_ _14"> </span><span class="ffe ls12e">'<span class="_ _13"> </span></span>2<span class="ls0">.</span>83</span></span></span></div><div class="t m0 x4b h10 y8c ff1 fsb fc0 sc0 ls12f wsf0">noise has no <span class="ff3 ls130 ws0">exact</span><span class="ls43 wsad"> <span class="ls131 wsf1">peak-to-peak value, it is <span class="ff3 ls132 ws0">approximately</span></span> <span class="ls133 wsf2">6 to 8 times the standard deviation.</span></span></div><div class="t m0 x4c h22 y8d ff1 fs13 fc0 sc0 ls134 wsf3">a. Square Wave, Vpp = 2<span class="ffd fs14 ls135 ws0">F</span></div><div class="t m0 x4d h22 y8e ff1 fs13 fc0 sc0 ls136 wsf4">c. Sine wave, Vpp = </div><div class="t m0 x4e h22 y8f ff1 fs13 fc0 sc0 ls43 ws0">2<span class="_ _21"> </span>2<span class="_ _d"></span><span class="ffd ls137">F</span></div><div class="t m0 x40 h22 y90 ff1 fs13 fc0 sc0 ls138 wsf5">d. Random noise, Vpp <span class="fff fs15 ls139 ws0">.</span><span class="ls43 ws0"> <span class="ls13a wsf6">6-8 </span><span class="ffd fs14 ls135">F</span></span></div><div class="t m0 x40 h22 y91 ff1 fs13 fc0 sc0 ls13b wsf7">b. Triangle wave, Vpp = </div><div class="t m0 x4f h22 y92 ff1 fs13 fc0 sc0 ls43 ws0">12<span class="_"> </span><span class="ffd ls137">F</span></div><div class="t m0 x2e h3 y93 ff1 fs1 fc0 sc0 ls13c wsf8">100 CALCULATION OF THE MEAN AND STANDARD DEVIATION</div><div class="t m0 x2e h3 y94 ff1 fs1 fc0 sc0 ls13d wsf9">110 '</div><div class="t m0 x2e h3 y7a ff1 fs1 fc0 sc0 ls13e wsfa">120 DIM X[511]<span class="_ _22"> </span><span class="ls13f wsfb">'The signal is held in X[0] to X[511]</span></div><div class="t m0 x2e h3 y95 ff1 fs1 fc0 sc0 ls140 wsfc">130 N% = 512<span class="_ _23"> </span><span class="ls141 wsfd">'N% is the number of points in the signal</span></div><div class="t m0 x2e h3 y96 ff1 fs1 fc0 sc0 ls13d wsf9">140 '</div><div class="t m0 x2e h3 y97 ff1 fs1 fc0 sc0 ls142 wsfe">150 GOSUB XXXX <span class="_ _24"> </span><span class="ls143 wsff">'Mythical subroutine that loads the signal into X[ ]</span></div><div class="t m0 x2e h3 y98 ff1 fs1 fc0 sc0 ls13d wsf9">160 '</div><div class="t m0 x2e h3 y99 ff1 fs1 fc0 sc0 ls144 ws100">170 MEAN = 0<span class="_ _25"> </span><span class="ls145 ws101">'Find the mean via Eq. 2-1</span></div><div class="t m0 x2e h3 y9a ff1 fs1 fc0 sc0 ls146 ws102">180 FOR I% = 0 TO N%-1</div><div class="t m0 x2e h3 y9b ff1 fs1 fc0 sc0 ls147 ws103">190 MEAN = MEAN + X[I%]</div><div class="t m0 x2e h3 y9c ff1 fs1 fc0 sc0 ls148 ws104">200 NEXT I%</div><div class="t m0 x2e h3 y82 ff1 fs1 fc0 sc0 ls149 ws105">210 MEAN = MEAN/N%</div><div class="t m0 x2e h3 y9d ff1 fs1 fc0 sc0 ls13d wsf9">220 '</div><div class="t m0 x2e h3 y9e ff1 fs1 fc0 sc0 ls14a ws106">230 VARIANCE = 0<span class="_ _26"> </span><span class="ls14b ws107">'Find the standard deviation via Eq. 2-2</span></div><div class="t m0 x2e h3 y9f ff1 fs1 fc0 sc0 ls146 ws102">240 FOR I% = 0 TO N%-1</div><div class="t m0 x2e h3 ya0 ff1 fs1 fc0 sc0 ls5c ws108">250 VARIANCE = VARIANCE + ( X[I%] - MEAN )^2</div><div class="t m0 x2e h3 ya1 ff1 fs1 fc0 sc0 ls148 ws104">260 NEXT I%</div><div class="t m0 x2e h3 ya2 ff1 fs1 fc0 sc0 ls14c ws109">270 VARIANCE = VARIANCE/(N%-1)</div><div class="t m0 x2e h3 ya3 ff1 fs1 fc0 sc0 ls14d ws10a">280 SD = SQR(VARIANCE)</div><div class="t m0 x2e h3 y4b ff1 fs1 fc0 sc0 ls13d wsf9">290 '</div><div class="t m0 x2e h3 ya4 ff1 fs1 fc0 sc0 ls14e ws10b">300 PRINT MEAN SD<span class="_ _27"> </span><span class="ls14f ws10c">'Print the calculated mean and standard deviation</span></div><div class="t m0 x2e h3 ya5 ff1 fs1 fc0 sc0 ls13d wsf9">310 '</div><div class="t m0 x2e h3 ya6 ff1 fs1 fc0 sc0 ls150 ws10d">320 END</div><div class="t m0 x50 h10 ya7 ff1 fsb fc0 sc0 ls151 ws10e">TABLE 2-1</div><div class="t m0 x51 h8 y34 ff1 fs6 fc0 sc0 ls152 ws10f">Table 2-1 lists a computer routine for calculating the mean and standard</div><div class="t m0 x51 h8 y69 ff1 fs6 fc0 sc0 ls153 ws110">deviation using Eqs. 2-1 and 2-2. The programs in this book are intended to</div><div class="t m0 x51 h8 y35 ff1 fs6 fc0 sc0 ls154 ws111">convey <span class="ff3 ls155 ws0">algorithms</span><span class="ls156 ws112"> in the most straightforward way; all other factors are</span></div><div class="t m0 x51 h8 y36 ff1 fs6 fc0 sc0 ls157 ws113">treated as secondary. Good programming techniques are disregarded if it</div><div class="t m0 x51 h8 y37 ff1 fs6 fc0 sc0 ls158 ws114">makes the program logic more clear. For instance: a simplified version of</div><div class="t m0 x51 h8 y38 ff1 fs6 fc0 sc0 ls159 ws115">BASIC is used, line numbers are included, the only control structure allowed</div><div class="t m0 x51 h8 y39 ff1 fs6 fc0 sc0 ls15a ws116">is the FOR-NEXT loop, there are no I/O statements, etc. Think of these</div><div class="t m0 x51 h8 y3a ff1 fs6 fc0 sc0 ls15b ws63">programs as an alternative way of understanding the equations used</div></div><div class="pi" data-data='{"ctm":[1.839080,0.000000,0.000000,1.839080,0.000000,0.000000]}'></div></div>