Download Document

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Direction finding wikipedia , lookup

Phase-locked loop wikipedia , lookup

Telecommunication wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Battle of the Beams wikipedia , lookup

Oscilloscope history wikipedia , lookup

Index of electronics articles wikipedia , lookup

Signal Corps (United States Army) wikipedia , lookup

Cellular repeater wikipedia , lookup

Analog television wikipedia , lookup

HD-MAC wikipedia , lookup

High-frequency direction finding wikipedia , lookup

Transcript
Biosignals and Systems
Prof. Nizamettin AYDIN
[email protected]
[email protected]
http://www.yildiz.edu.tr/~naydin
1
BASIC SIGNALS
• Signals are the foundation of information
processing, transmission, and storage.
• They also provide the interface with
physiological systems and are the basis for
communication between biological processes.
• Understanding the basics of signals is
fundamental to understanding, and interacting
with biological processes.
• A few signals are simple and can be defined
analytically, that is as mathematical functions.
2
Biosignals
• Signals continuously pass
between various parts of the
body.
• These biosignals are carried
either by electrical energy, as
in the nervous system, or by
molecular signatures, as in
the endocrine system and
many other biological
processes.
• Measurement of these
biosignals is fundamental to
diagnostic medicine and to
bioengineering research.
3
The Sinusoidal Waveform
• A sinusoidal waveform is defined as:
 2t 
x(t )  A sinpt   A sin2fpt   A sin

 T 
where A is the signal amplitude, specifically the peakto-peak amplitude, p is the frequency in radians per
second, fp is the frequency in Hz, T is the period in
seconds, and t is time in seconds.
• The frequency can be expressed in either radians/sec
or Hz ( the units formerly known as cycles per
second), and are related by 2π:
p  2fp
4
Sinusoids
• The frequency is also the inverse of the period, T:
1
fp 
T
• A sinusoidal is completely defined by A and fp (or T).
• Sinewave-like signals can be represented by either
sines or cosines, and the two are related.:
5
Sinusoids
• Because a sinusoidal signal is completely
defined by A and fp, (if neither the amplitude
nor the frequency changes over time) it is hard
to see how this signal could carry much
information.
• However, sine waves (and cosine waves) are at
the foundation of many signal analysis
techniques.
– their importance stems from their simplicity and
the way they are treated by linear systems.
6
General Sinusoids
• A general “sinusoid” (as opposed to a pure sinewave
or pure cosinewave) will have a general phase term
• where again the phase, , would be expressed in
degrees even though the frequency descriptor is
expressed in radians or hertz.
7
General Sinusoids
• To convert the difference in phase angle to a difference in time,
note that the phase angle varies over 360 deg. during one
period, T.
• To determine the time difference or time delay between the
two sinusoids, td, given the phase angle:
td 

360
T =

360 f
td
or   360  360tdf
T
8
Example
• Two 2-Hz
sinusoids that
differ in phase
by 60 degrees.
• T = 1/f = 0.5 s.
• Time delay:
td = ( /360)T
= (60/360)0.5
= 0.0833 s.
= 83.3 ms.
9
Example 1…
• Find the time delay between two sinusoids:
x1(t) = cos(4t + 30), and
x2(t) = -2sin(4t)
10
…Example 1
• Solution:
Convert both to either a sine or cosine (here we convert to cosines):
x2(t) = -2sin(4t) = -2cos(4t - 90)
• So the total angle between the two sinusoids is 30 -(-90) = 120 deg.
• Since the period is:
• The time delay is:
1
1
1
T 

 157
. sec.

4
f
2
2

120
td 
T
157
.  0.523 sec.
360
360
11
TIME-SHIFT
• Whenever a signal can be expressed in the
form x1(t)=s(t-t1), we say that x1(t) is time
shifted version of s(t)
– If t1 is a + number, then the shift is to the right, and
we say that the signal s(t) has been delayed in time.
– If t1 is a - number, then the shift is to the left, and
we say that the signal s(t) was advanced in time.
12
TIME-SHIFTED SINUSOID
x (t  4)  5 cos(0.3 (t  4))  5 cos(0.3 (t  ( 4))
13
Basic properties of the sine and cosine functions
14
Sinusoidal Arithmetic
• Sometimes it is mathematically convenient to represent a
sinusoid as a combination of a pure sine and a pure cosine.
• This representation can be achieved using the well-known
trigonometric identities for the sum of two arguments of a
cosine function:
15
To convert from a sinusoid with phase to a sine plus cosine
• For example, to convert from cos(ωt - ) to
sin( ωt) + cos(ωt), use the trigonometric identity:
cos(x - y) = cos(x) cos(y) + sin(x) sin(y)
• Based on this identity, the equation for a sinusoid can
be written as:
Ccos(2πft-) = Ccos(2πft) cos( ) + Csin(2πft) sin( )
Ccos(2πft-) = a cos(2πft) cos( ) + b sin(2πft) sin( )
where a = Ccos( ) , b = Csin( )
16
To convert from a sine and cosine to a single sinusoid
• For example, to convert from sin(2πft) + cos(2πft) to
sin(2πft + ), use the trigonometric identity:
sin(x + y) = cos(x) sin(y) + sin(x) cos(y)
Csin(2πft+) = Csin() cos(2πft ) + Ccos() sin(2πft )
Csin(2πft+) = a cos(2πft) + b sin(2πft)
• The magnitude of the single
sinusoid can be determined as:
• The phase of the single
sinusoid can be determined as:
a 2+b 2 = C 2 cos2 + sin2   C 2
C
a 2+b 2
b C sin( )

 tan( )
a C cos( )
and...
 b
 = tan  
 a
-1
17
• Care must be taken in evaluating  = tan-1(b/a) to
ensure that  is determined to be in the correct
quadrant on the basis of the signs of a and b.
– If both a and b are positive,  must be between 0 and 90
degrees;
– If b is positive and a is negative,  must be between 90 and
180 degrees
– If both a and b are negative, must be between 180 and 270
degrees
– If b is negative and a is positive,  must be between 270
and 360 degrees.
• Again, it is common to use degrees for phase angle.
18
Sinusoidal Arithmetic
• To add sine or cosine waves, simply add their
amplitudes:
a1 cos(t )  a 2 cos(t )  (a1  a 2) cos(t )
a1 sin(t )  a 2 sin(t )  (a1  a 2) sin(t )
assuming that they are all at the same frequency, ω
• To add two sinusoids
• i.e., C sin(ωt + θ) or C cos(ωt – θ)
– convert them to sines and cosines using the equations above,
– add sines to sines and cosines to cosines, and
– convert back to a single sinusoid if desired.
19
Example 2…
• Convert the following sum of a sine and cosine wave,
x(t) = -5 cos(10t) - 3 sin(10t)
into a single sinusoid.
20
…Example 2
• Solution:
Apply previous equations
a  5
C
and
a 2  b2 
b  3
52  32  583
.
 b
 1  3
  tan    tan    31deg,
 a
  5
1
but  must be in the 3rd quadrant since both a and b are negative:
  31  180  211 deg.
• Therefore, the single sinusoid representation would be:
x(t )  583
. cos10t  211
21
Example 3…
• Combine
x(t) = 4 cos (2t - 30) - 3 sin(2t +60)
into a single sinusoid.
22
…Example 3…
•
•
•
•
Solution:
First expand each sinusoid into a sum of cosine and sine,
then algebraically add the cosines and sines,
then recombine them into a single sinusoid.
– Be sure to convert the cos into a sin
• recall: sin(x) = cos(x-90) ) before expanding this term.
• then recombine them into a single sinusoid.
4 cos (2t - 30) = a cos(2t) + b sin(2t)
a = Ccos( ) = 4cos(30) ≈ 3.5, b = Csin( ) = 4sin(30) = 2
4 cos (2t - 30) = 3.5 cos(2t) + 2 sin(2t)
23
…Example 3
• 3 sin(2t +60) = 3 cos (2t + 60 - 90) = 3 cos (2t - 30)
a = Ccos( ) = 3cos(30) ≈ 2.6, b = Csin( ) = 3sin(30) = 1.5
3 sin(2t +60) = 2.6 cos(2t) + 1.5 sin(2t)
• Combining cosine and sine terms algebraically:
4 cos (2t - 30) - 3 sin(2t +60)
= 3.5 cos(2t) + 2 sin(2t) - 2.6 cos(2t) - 1.5 sin(2t)
= 0.9 cos(2t) - 0.5 sin(2t)
C =sqrt( (0.9)2+(0.5)2) ≈ 1,
 = tan-1(-0.5/0.9) ≈ -30
• So, the combined sinusoid is:
x(t) = cos (2t - 30) = cos (2t + 330)
24
Example 3 – alternative solution
• x(t) = 4 cos (2t - 30) - 3 sin(2t + 60)
• sin(2t +60) = cos (2t + 60 - 90) = cos (2t - 30)
• x(t) = 4 cos (2t - 30) - 3 cos(2t - 30)
• x(t) = cos (2t - 30)
25
Example 4…
• Combine
x(t) = 4 cos(2t + 30) - 3 sin(2t - 60)
into a single sinusoid.
26
…Example 4
• x(t) = 4 cos (2t + 30) - 3 sin(2t - 60)
•
•
•
•
sin(2t - 60) = cos (2t - 60 - 90) = cos (2t - 150)
sin(2t - 60) = cos ((2t +30) - 180)
sin(2t - 60) = cos (2t +30)cos(180) + sin((2t +30)sin(180)
sin(2t - 60) = -cos (2t +30)
• x(t) = 4 cos (2t + 30) - 3 (-cos(2t + 30))
• x(t) = 7cos (2t + 30)
27
Complex Numbers
• An even more compact representation of a sinusoid can be
obtained if one is willing to use complex notation.
• A “complex number” combines a “real number” and an
“imaginary number.”
• Real numbers are common.
• Imaginary numbers are the product of square roots and are
represented by real numbers multiplied by the √-1.
– the letter j or i represent the √-1.
•
Complex numbers behave as if the real and imaginary parts
are orthogonal.
– This means that the two components are independent of one another.
• Complex numbers and complex variables are actually two
numbers, or variables, rolled into one.
28
• A complex number
represented as an orthogonal
combination of a real number
on the horizontal axis and an
imaginary number on the
vertical axis.
• This graphic representation is
useful for understanding
complex numbers and aids in
the interpretation of some
arithmetic operations.
29
Complex Representation of a Sinusoid
• The feature that a complex number is actually two
separate numbers is particularly handy when sinusoids
are involved,
– since a sinusoid at a given frequency can be uniquely
defined by two variables:
• its magnitude and phase angle,
• or equivalently, its cosine and sine magnitudes (a and b).
• A sinusoid at a given frequency can be represented by
a single complex number.
• To find the complex representation, we will use the
identity developed by the Swiss mathematician, Euler:
ejx  cos x  j sin x
30
• Euler equation links sinusoids and exponentials,
– providing a definition of the sine and cosine in terms of
complex exponentials.
• It also provides a concise representation of a sinusoid
since a complex exponential contains both a sine and
a cosine
• This equation will prove very useful in two
sinusoidally based analysis techniques:
– Fourier analysis
– phasor analysis
31
Signal Properties: Basic Measurements
• Biosignals and other information-bearing signals are often
quite complicated and defy a straightforward analytical
description.
• An archetype biomedical signal is the electrical activity of the
brain as it is detected on the scalp by electrodes, the
electroencephalogram (EEG) shown in the following figure.
• Although a time display of this signal, as in the following
figure , constitutes a unique description, the information
carried by this signal is not apparent from the time display, at
least not to the untrained eye.
• Nonetheless, physicians and technicians are trained to extract
useful diagnostic information by examining the time display of
biomedical signals including the EEG.
32
Segment of an electroencephalogram signal
33
Signal Properties: Basic Measurements
• The time display of the electrocardiogram (ECG) signal is so medically
useful that it is displayed continuously for patients undergoing surgery or
those admitted to intensive care units (ICUs).
• This signal has become an indispensable image in television and movie
medical dramas.
• Medical images, which can be thought of as two-dimensional signals, often
need only visual inspection to provide information useful for diagnosis.
34
Signal Properties: Basic Measurements
• A time domain representation of a signal offers a complete
description of the signal (if properly sampled), but this
representation may not be very informative.
•
One basic measurement of a signal is its mean or average
value
1
x=
N
1 T
x(t) =  x(t) dt
T 0
•
N
x
k
k=1
Another useful basic measurement is the rms value:
1

x(t)rms =   x(t)2 dt 
T 0

T
1
2
1
x rms = 
N

2
xk 

k=1

N
1
2
35
Example 5…
• Find the RMS value of a sinusoidal signal.
36
…Example 5
• Solution
Since this signal is periodic, with each period the same as the
previous one, it is sufficient to apply the RMS equation over a
single period. (Nothing changes in a sinusoid from one period to the next.)
1

2


2


1 T
1 T 2 
 2 t  
x(t)rms =   x(t) dt      Asin
  dt 
0
0
T

 Tp  
 T 

1
T
2
 1 A2 

 2 t   2 t   t 

 sin
  
  cos



T
T  T  0 
 T 2 
1
2
A
 2
   cos 2  sin 2     cos 0 sin 0
 2

1
A

 2 
2
1
2
A 
 
 2
2
2
1
2
 .707 A
37
Other Basic Measurements
• Two other basic measurements that can be applied to
signals, particularly those having some random or
noise characteristics are the standard deviation, σ, and
the variance, σ2.
 1 N
2
= 
(xk - x) 

 N-1 k=1

1
2
N
1
2
2=
(x
x)

N -1 k=1 k
where x with the bar over it is the mean or signal
average.
• If the signal mean is zero, the standard deviation is
the same as the RMS value, except that the standard
deviation is normalized by N-1 instead of N.
38
A segment of electroencephalogram signal with
the positive and negative standard deviation
39
The Influence of Averaging on Noise
• When multiple measurements are made, multiple values or signals will be
generated. If multiple measurements are added, the means add so that the
combined value or signal has a mean that is the average of the individual
means. The variances also add and the average variance is the mean of the
individual variances:
N
_

2
1
=
N

2
k
k=1
• However, the standard deviation is the square root of the variance and the
standard deviations add as the √N times the average standard deviation.
The mean standard deviation is the average of the individual standard
deviations divided by √N :
If; 
N
2
avg
=

k=1
N
2
k
; then:

k
=
_
N
_
2
=
N 
k=1
1 N
1
Mean Standard Deviation =



N k=1 k
N
N = 
N
40
MATLAB implementation
• Calculating the average, standard deviation, or variance
may be done in MATLAB using the following
commands:
xm = mean(x);
% Evaluate mean of x
xvar = var(x);
% Evaluate the variance of x normalizing by N-1
xnorm = var(x,1);
% Evaluate the variance of x normalizing by N
xstd = std(x);
% Evaluate the standard deviation of x,
• If these routines are given a matrix variable, then they
operate on each column with the result in a row matrix.
41
Decibels ~ Revisited
• When used to measure power, the decibel is 10 bels,
or 10 times the log of the power:
 P2 
Pdb  10 log 
 P1 
• When used to in voltage measurements, the decibel is
20 times the log of voltage:
• Since:
 v22 
2
v


 v2 
2
R


vdb  10 log 2
= 10log 2   20 log 
 v1 
 v1 
 v1 


R
2
V
P  RMS
R
42
Example 6…
• A sinusoidal signal is fed into an “attenuator” that
reduces the intensity of the signal.
• The input signal has a peak-to-peak amplitude of 2.8 V
and the output signal is measured at 2 V peak-to-peak.
• Find the ratio of output to input voltage in db.
43
…Example 6
VRMS db
VRMS db
 2.0  0.707 
 20 log( Vout RMS / Vin RMS )  20 log 

 2.8  0.707 
 3 dB
The power ratio is :
Power ratio 
2
Vout
RMS
Vin2RMS
(2.0  0.707) 2

 0.5
2
(2.8  0.707)
• The ratio of the amplitude of a signal coming out of a
process to that going into the process is known as the
gain, and is often given in db.
44
Ensemble Averaging
• Averaging can be applied not only to a series of
numbers, but to a series of waveforms.
• Ensemble averaging is used when a number of similar
time responses can be obtained from a system.
• As long as some time reference is available, then
averages of a number of responses can be taken at
each point in time to create an averaged time
response.
• An example of ensemble averaging is given in the
following example.
45
Example 7…
• Find the average response given a number of
individual responses from the vergence eye
movement system.
• The vergence eye movement system is
responsible for turning the eye inward to view a
near target.
• These responses are stored in MATLAB file
verg1.mat.
46
…Example 7
• Solution:
Use the MATLAB averaging routine ‘mean’. If this routine is given a matrix
variable, it averages each column. Hence, if the various signals are arranged as
rows in the matrix, the ‘mean’ routine will produce the ensemble average as a
row matrix.
load verg1;
Ts = .005;
[nu,N] = size(data_out);
t = (1:N)*Ts;
plot(t,data_out,'k'); hold on;
avg = mean(data_out);
plot(t,avg-3,'k');
% Get vergence eye movement data;
% Sample interval = 5 msec
% Get data length (N)
% Generate time vector (t = N Ts)
%
% Plot ensemble data superimposed
%
% Construct and plot the ensemble average
% Calculate ensemble average and
% plot, also label axes
47
Ensemble Averaging
5
4
3
Eye Position
2
Averaged Data
1
T1
0
-1
-2
-3
-4
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
Time (sec)
Upper traces: An ensemble of individual (vergence) eye movement responses to a step
change in stimulus. Lower trace: The ensemble average, displaced downward for clarity.
The ensemble average is constructed by averaging the individual responses at each point in
time. Hence, the value of the average response at time T1 (vertical line) is the average of the
individual responses at that time.
48
49