Professional Documents
Culture Documents
Lecture 1
Introduction to Signals
4 February 2020 2
Applications of DSP
The roots of DSP are in the 1960s and 1970s when digital computers first became
available. Computers were expensive during this era, and DSP was limited to only a
few applications:
radar & sonar, where national security was at risk;
oil exploration, where large amounts of money could be made;
space exploration, where the data are irreplaceable;
medical imaging, where lives could be saved.
mass &
t spring t
system
r 0 (t)
h 1 (t)
r 1 (t) r 0 (t) r 2 (t)
h 2 (t) tank
t t
system
r 2 (t)
sound in sound o u t
cell
t phone t
system
4 February 2020
5
Signals and Systems
sound o u t
sound in
Composite system
sound sound
cell phone system
in out
Component and composite systems have the same form, and are
analyzed with same methods.
4 February 2020
7
DSP - interdisciplinary course
4 February 2020 8
Statistics, Probability and
Noise
Lecture 2
4 February 2020 9
Signal and Graph Terminology
A signal is a description
of how one parameter is
related to another
parameter.
Signals are
mathematical functions.
independent variable
= time
dependent variable =
voltage, flow rate,
sound pressure
4 February 2020 10
Signal and Graph Terminology
Since both parameters can assume a continuous range of values, we will call
this a continuous signal. In comparison, passing this signal through an
analog-to-digital converter (ADC) forces each of the two parameters to be
quantized.
Imagine the conversion being done with 12 bits at a sampling rate of 1000
samples per second. The voltage is 4096 (212) possible binary levels, and the
time is only defined at one millisecond increments. Signals formed from
parameters that are quantized in this manner are said to be discrete signals
or digitized signals.
It is also possible to have signals where one parameter is continuous and the
other is discrete.
4 February 2020 11
Signal and Graph Terminology
continuous “time” ( C T ) discrete “time” ( D T )
x(t) x[n]
t n
0 2 4 6 8 10 0 2 4 6 8 10
t n
0T 2T 4T 6T 8T 10T 0 2 4 6 8 10
T = sampling interval
x [n] x (t)
n t
0 2 4 6 8 10 0 2T 4T 6T 8T 10T
T = sampling interval
x [n] x (t)
n t
0 2 4 6 8 10 0 2T 4T 6T 8T 10T
T = sampling interval
4 February 2020 16
Signal and Graph Terminology
Previous slide shows two discrete signals, such as might be acquired with a
digital data acquisition system. The vertical axis may represent voltage, light
intensity, sound pressure, or an infinite number of other parameters. Since we
don't know what it represents in this particular case, we will give it the generic
label: amplitude.
This parameter is also called several other names: the y-axis, the dependent
variable, the range, and the ordinate.
The horizontal axis represents the other parameter of the signal, going by such
names as: the x-axis, the independent variable, the domain, and the
abscissa.
4 February 2020 17
Signal and Graph Terminology
Time is the most common parameter to appear on the horizontal axis
of acquired signals; however, other parameters are used in specific
applications.
4 February 2020 18
Signal and Graph Terminology
The two parameters that form a signal are generally not interchangeable.
Given a specific value on the x-axis, we can always find the corresponding
value on the y-axis, but usually not the other way around.
4 February 2020 19
Domain
A signal that uses time as the independent variable (i.e., the parameter on
the horizontal axis), is said to be in the time domain.
4 February 2020 20
Sample number
The variable, N, is widely used in DSP to represent the total number of
samples in a signal.
𝑖 = 1, … , 𝑁
𝑜𝑟 𝑖 = 0, … . , 𝑁 − 1
4 February 2020 24
Standard Deviation
In equation form, the standard deviation is calculated:
𝑥0 − 𝜇 2 + 𝑥1 − 𝜇 2 + ⋯ + 𝑥𝑁−1 − 𝜇 2
𝜎=
𝑁−1
The term 2 occurs frequently in statistics and is given the name variance.
The standard deviation is a measure of how far the signal fluctuates from the
mean. The variance represents the power of this fluctuation. Another term you should
become familiar with is the rms (root-mean-square) value, frequently used in
electronics.
4 February 2020 25
Relationship between the standard deviation
and the peak-to-peak (Vpp) value
4 February 2020 26
Signal-to-noise ratio (SNR)
In some situations, the mean describes what is being measured, while the
standard deviation represents noise and other interference. In these
cases, the standard deviation is not important in itself, but only in
comparison to the mean.
Signal-to-noise ratio (SNR), which is equal to the mean divided by the
standard deviation.
𝝁
𝑺𝑵𝑹 =
𝝈
Using the Logarithmic decibel scale:
𝑷𝒔𝒊𝒈𝒏𝒂𝒍
𝑺𝑵𝑹𝒅𝑩 = 𝟏𝟎 𝒍𝒐𝒈𝟏𝟎
𝑷𝒏𝒐𝒊𝒔𝒆
𝑃𝑠𝑖𝑔𝑛𝑎𝑙 - power of a signal (meaningful information), 𝑃𝑛𝑜𝑖𝑠𝑒 -power of
background noise (unwanted signal)
𝑆𝑁𝑅𝑑𝐵 = 10 log10 (𝑆𝑁𝑅)
4 February 2020 27
Coefficient of variation (CV)
𝝈
𝑪𝑽 = ∙ 𝟏𝟎𝟎%
𝝁
A signal (or other group of measure values) with a CV of 2%, has an
SNR of 50. Better data means a higher value for the SNR and a lower
value for the CV.
4 February 2020 28
Histogram
Suppose we attach an 8 bit analog-to-digital converter to a
computer, and acquire 256000 samples of some signal. As an
example, Figure (a) shows 128 samples that might be a part of this
data set.
The value of each sample will be one of 256 possibilities, 0 through
255.
The histogram displays the number of samples there are in the
signal that have each of these possible values. Figure (b) shows the
histogram for the 128 samples in (a).
4 February 2020 29
Histogram
4 February 2020 30
Histogram
Hi is histogram values, where 𝑖 = 0, 𝑀 − 1 (M is the number of
possible values that each sample can take on). For instance,
H50 is the number of samples that have a value of 50.
Figure (c) shows the histogram of the signal using the full data
set, all 256000 points.
The larger number of samples results in a much smoother
appearance.
The statistical noise (roughness) of the histogram is inversely
proportional to the square root of the number of samples used.
4 February 2020 31
Histogram
4 February 2020 32
Histogram
The sum of all of the values in the histogram must be equal to the
number of points in the signal:
𝑀−1
𝐻𝑖 = 𝑁
𝑖=0
The mean and standard deviation are calculated from the histogram
by the equations:
𝑀−1
1
𝜇 = 𝑖 𝐻𝑖
𝑁
𝑖=0
𝑀−1
1
𝜎2 = 𝑖 − 𝜇 2 𝐻𝑖
𝑁−1
𝑖=0
4 February 2020 33
Probability mass function (pmf)
Acquired signal (measured data) is a noisy version of the
underlying process.
The histogram is formed from an acquired signal.
The corresponding curve for the underlying process is called
the probability mass function (pmf).
A histogram is always calculated using a finite number of
samples, while the pmf is what would be obtained with an
infinite number of samples.
The pmf can be estimated from the histogram.
4 February 2020 34
Probability mass function (pmf)
Vertical axis of the histogram is the
number of times that a particular value
occurs in the signal.
Vertical axis of the pmf contains similar
information, except expressed on a
fractional basis. In other words, each value
in the histogram is divided by the total
number of samples to approximate the pmf.
Each value in the pmf must be between 0
and 1.
Sum of all of the values in the pmf will be
equal to 1.
4 February 2020 35
Probability distribution function (pdf)
The probability density function
(pdf), also called the probability
distribution function, is to
continuous signals what the
probability mass function is to discrete
signals.
The pdf of the analog signal is shown
by the continuous line, indicating the
signal can take on a continuous
range of values, such as the voltage
in an electronic circuit.
4 February 2020 36
Probability distribution function (pdf)
The vertical axis of the pdf is in units of probability density.
For example, a pdf of 0.03 at 120.5 does not mean that the a
voltage of 120.5 millivolts will occur 3% of the time.
In fact, the probability of the continuous signal being exactly
120.5 millivolts is infinitesimally small. This is because there are
an infinite number of possible values:
120.49997, 120.49998, 120.49999, etc.
The chance that the signal happens to be exactly 120.5 is very
small!
4 February 2020 37
Probability distribution function (pdf)
To calculate a probability, the probability density is multiplied by a range of
values.
For example, the probability that the signal, at any given instant, will be between
the values of 120 and 121 is:
(121-120) × 0.03 = 0.03 .
The probability that the signal will be between 120.4 and 120.5 is:
(120.5-120.4) × 0.03 = 0.003
If the pdf is not constant over the range of interest, the multiplication becomes
the integral of the pdf over that range. In other words, the area under the pdf
bounded by the specified values.
The total area under the pdf curve, the integral from - to + will always be equal
to 1.
4 February 2020 38
Continuous waveforms and pdf
4 February 2020 39
Normal Distribution (Gaussian)
Signals formed from random
processes usually have a bell
shaped pdf. This is called a
normal distribution, a Gauss
distribution, or a Gaussian.
The basic shape of the curve is
generated from a negative
squared exponent:
−𝒙𝟐
𝒚 𝒙 =𝒆
4 February 2020 40
Normal Distribution (Gaussian)
This raw curve can be converted into the complete Gaussian
by adding an adjustable mean, μ, and standard deviation, . In
addition, the equation must be normalized so that the total area
under the curve is equal to one, a requirement of all probability
distribution functions. This results in the general form of the
normal distribution, one of the most important relations in
statistics and probability:
4 February 2020 41
Gaussian curves
The mean centers the curve over a particular value, while the
standard deviation controls the width of the bell shape.
4 February 2020 42
Cumulative distribution function (cdf)
Integral of the pdf is used to find the probability that a signal will be
within a certain range of values. This makes the integral of the pdf
important enough that it is given its own name, the cumulative
distribution function (cdf).
Gaussian cannot be integrated using elementary methods.
Integral of the Gaussian can be calculated by numerical integration.
The discrete curve resulting from this simulated integration is then
stored in a table for use in calculating probabilities.
To calculate the probability that the signal will be between two
values, it is necessary to subtract the appropriate numbers found in
the table.
4 February 2020 43
Cumulative distribution function (cdf)
4 February 2020 44
Cumulative distribution function (cdf)
Samples taken from a normally distributed signal will be
4 February 2020 45
Digital Noise Generation
A common need in DSP is to generate signals that resemble various types of
random noise. This is required to test the performance of algorithms that must
work in the presence of noise.
4 February 2020 46
Random number generator (RND)
Digital noise generation is carried out by random number
generator (standard function).
In Matlab - X=RAND() loads the variable, X, with a new
random number each time the command is encountered.
Each random number has a value between 0 and 1, with an
equal probability of being anywhere between these two
extremes.
4 February 2020 47
Random number generator (RND)
Random signal formed by taking 128 samples from random number
generator.
1
𝜇 = 0.5 , σ = = 0.29
12
the distribution is uniform between 0 and 1.
4 February 2020 48
Random number generator (RND)
Algorithms need to be tested using the same kind of data they will encounter in
actual operation.
This creates the need to generate digital noise with a Gaussian pdf.
There are two methods for generating such signals using a random number
generator.
1st method – adding 12 random signals
When 2 random numbers are added:
X = RAND+RAND.
𝟏
X can run from 0 to 2. 𝝁 = 𝟏, 𝝈 = (when independent random signals are added,
𝟔
the variances also add).
the pdf has changed from a uniform distribution to a triangular distribution.
4 February 2020 49
From Uniform to Triangular distribution
4 February 2020 50
From Uniform to Gaussian distribution
Adding 12 random numbers:
X=RAND+RAND+…+RAND 12 times
𝝁 = 𝟔, 𝝈 = 𝟏.
Pdf has become
a Gaussian.
4 February 2020 51
Creating a normally distributed noise signal
This procedure can be used to create a normally distributed noise signal with an
arbitrary mean () and standard deviation ().
Algorithm:
1. add twelve random numbers; X=RAND+….+RAND
2. subtract six to make the mean equal to zero; X=X-6
3. multiply by the standard deviation desired; X=X*
4. add the desired mean. X=X+
The mathematical basis for this algorithm is contained in the Central Limit
Theorem, one of the most important concepts in probability.
Central Limit Theorem states that a sum of random numbers becomes
normally distributed as more and more of the random numbers
are added together.
The Central Limit Theorem provides the reason why normally distributed signals
are seen so widely in nature. Whenever many different random forces are
interacting, the resulting pdf becomes a Gaussian.
4 February 2020 52
Creating a normally distributed noise
signal (2nd method)
For generating normally distributed random numbers, the random
number generator is used twice, to obtain R1 and R2.
𝑹𝟏 = 𝑹𝑨𝑵𝑫, 𝑹𝟐 = 𝑹𝑨𝑵𝑫
A normally distributed random number, X, can then be found:
𝑿= −𝟐𝒍𝒐𝒈𝑹𝟏 𝒄𝒐𝒔(𝟐𝝅𝑹𝟐 )
There is some parameter you wish to know the value of. This is
called the true value, or simply, truth.
4 February 2020 55
Precision and Accuracy
Consider an oceanographer measuring water depth using
a sonar system.
Short bursts of sound are transmitted from the ship,
reflected from the ocean floor, and received at the surface
as an echo.
Sound waves travel at a relatively constant velocity in
water, allowing the depth to be found from the elapsed
time between the transmitted and received pulses.
A certain amount of error exists between the measured
and true values.
This particular measurement could be affected by many
factors: random noise in the electronics, waves on the
ocean surface, plant growth on the ocean floor, variations
in the water temperature causing the sound velocity to
change,
4 February 2020 etc. 56
Precision and Accuracy
The oceanographer takes many successive readings at a
location known to be exactly 1000 meters deep (the true
value).
These measurements are then arranged as the histogram.
As would be expected from the Central Limit Theorem, the
acquired data are normally distributed.
The mean occurs at the center of the distribution, and
represents the best estimate of the depth based on all of the
measured data.
The standard deviation defines the width of the distribution,
describing how much variation occurs between successive
measurements.
4 February 2020 57
Precision and Accuracy
1. The mean may be shifted from
the true value. The amount of this
shift is called the accuracy of the
measurement.