Sinusoids Lecture # Chapter BME 30 Biomedical Computing - 8
What Is this Course All About? To Gain an Appreciation of the Various Types of Signals and Systems To Analyze The Various Types of Systems To Learn the Skills and Tools needed to Perform These Analyses. To Understand How Computers Process Signals and Systems BME 30 Biomedical Computing - 9
Sinusoidal Signal Sinusoidal Signals are periodic functions which are based on the sine or cosine function from trigonometry. The general form of a Sinusoidal Signal x(t)=a cos(ω o t+ϕ) Or x(t)=a cos(πf o t +ϕ) where cos ( ) represent the cosine function We can also use sin( ), the sine function ω o t+ϕ or πf o t +ϕ is angle (in radians) of the cosine function Since the angle depends on time, it makes x(t) a signal ω o is the radian frequency of the sinusoidal signal f o is called the cyclical frequency of the sinusoidal signal ϕ is the phase shift or phase angle A is the amplitude of the signal BME 30 Biomedical Computing - 0
Example x(t)=0 cos(π(440)t -0.4π) 0 0-0 0.00 0.0 0.0 0.0-0 - One cycle takes /440 =.007 seconds This is called the period, T, of the sinusoid and is equal to the inverse of the frequency, f BME 30 Biomedical Computing -
Sine and Cosine Functions Definition of sine and cosine y θ r x Depending upon the quadrant of θ the sine and cosine function changes As the θ increases from 0 to π/, the cosine decreases from to 0 and the sine increases from 0 to As the θ increases beyond π/ to π, the cosine decreases from 0 to - and the sine decreases from to 0 As the θ increases beyond π to 3π/, the cosine increases from - to 0 and the sine decreases from 0 to - As the θ increases beyond 3π/ to π, the cosine increases from 0 to and the sine increases from - to 0 BME 30 Biomedical Computing - y sin r y r sin x cos r x r cos
Properties of Sinusoids cosine sine sine cosine 0. 0. 0. 0-9.4-6.8-3.4 0 3.4 6.8 9.4 0-9.4-6.8-3.4 0 3.4 6.8 9.4 0-9.4-6.8-3.4 0 3.4 6.8 9.4-0. -0. -0. - - - Equivalence Property Equation sin θ = cos (θ π / ) or cos θ = sin (θ + π/) Periodicity cos (θ + πk)=cos θ or sin (θ +πk)=sin θ where k is an integer Evenness of cosine cos θ = cos (-θ ) Oddness of sine sin θ = -sin (-θ ) Zeros of sine sin πk = 0, when k is an integer Zeros of cosine cos [π(k+)/] = 0, when k is an even integer; odd multiples of π/ Ones of the cosine cos πk =, when k is an integer; even multiples of π Ones of the sine sin [π(k+/)] =, when k is an even integer; alternate odd multiples of π/ Negative ones of the cosine cos [π(k +)/]= -, when k is an integer; odd multiples of π Negative ones of the sine sin [π(k +/)]= -, when k is an odd integer; alternate odd multiples of 3π/ BME 30 Biomedical Computing - 3
Properties of Sinusoids K (K+)/ X pi() cosine K K+/ X pi() sine 0 0..7 0 0 0..7 3.4 -. 4.7 -. 4.7 0. 7.84 3 6.83 3 3. 0.996-4. 7.84 0 4 4. 4.37 3 9.4 -. 7.79-6 3. 0.996 0 6 6. 0.40 7 4.66 7 7. 3.6-8 4. 4.37 0 8 8. 6.704 BME 30 Biomedical Computing - 4
Identities and Derivatives Number Equation sin θ +cos θ = cos θ = cos θ sin θ 3 sin θ = sin θ cos θ 4 sin (a ± b) = sin a cos b ± cos a sin b cos (a ± b) = cos a cos b sin a sin b 6 cos a cos b = [cos (a + b) + cos (a - b)]/ 7 sin a sin b = [cos (a - b) - cos (a + b)]/ 8 cos θ = [ + cos θ]/ 9 sin θ = [ - cos θ]/ 0 d sin θ / dθ = cos θ d cos θ / dθ = -sin θ BME 30 Biomedical Computing -
Sinusoidal Signal The general form of a Sinusoidal Signal x(t)=a cos(ω o t+θ) = A cos(πf o t+θ) ω o = πf o is the radian frequency of the sinusoidal signal Since ω o t has units of radians which is dimensionless, ω o has units of rad/sec f o is called the cyclical frequency of the sinusoidal signal Has units of sec - or Hz (formerly, cycles per second) θ is the phase shift or phase angle Has units of radians A is the amplitude of the signal and is the scaling factor that determines how large the signal will be. Since the cosine function varies from - to + then our signal will vary from A to +A. A is sometimes called the peak of the signal and A is called the peak-to-peak value BME 30 Biomedical Computing - 6
Sinusoid Signals x(t)=0 cos(π(40)t -0.4π) 0 0 0-0.03-0.0-0.0-0 0.0 0.0 0.03 0.04-0 - -0 A = 0, ω o = π(40), f o = 40, θ = - 0.4π Maxima at π(40)t-0.4π =πk or when t =, -0.0, 0.00, 0.03, Minima at π(40)t-0.4π =π(k+.) or when t = -0.007, 0.07 Time Period (/f o ) between = 0.00- (-0.0) =0.0 sec BME 30 Biomedical Computing - 7
Relation of Period to Frequency Periodof a sinusoid, T o, is the length of one cycle and T o = /f o The following relationship must be true for all Signals which are periodic (not ust sinusoids) x(t + T o ) = x(t) So A cos(ω o (t + T o ) + θ) = A cos(ω o t+θ) A cos(ω o t + ω o T o + θ) = A cos(ω o t+θ) BME 30 Biomedical Computing - 8
Relation of Period to Frequency Continued Since a sinusoid is periodic in π, this means: since T o = /f o Then ω o T o = πf o T o ω o T o = π therefore, T o = π/ω o The period is in units of seconds The frequency is in units of sec - or Hz (formerly, cycles per second) BME 30 Biomedical Computing - 9
Frequencies A cos(πf o t+θ) for 00 Hz, 00 Hz, 0 Hz 00 Hz -0.0-0.0-0.00 0 0.00 0.0 0.0 0.0-0 Hz 00 Hz -0.0-0.0-0.00 0 0.00 0.0 0.0 0.0-0.0-0.0-0.00 0 0.00 0.0 0.0 0.0 - - BME 30 Biomedical Computing - 30
Phase Shift and Time Shift The phase shift parameter θ (with frequency) determines the time locations of the maxima and minima of the sinusoid. When θ = 0, then for positive peak at t = 0. When θ 0, then the phase shift determines how much the maximum is shifted from t = 0. However, delaying a signal by t seconds, also shifts its waveform. BME 30 Biomedical Computing - 3
Time Shifting Look at the following waveform: s( t) t (4 t) 3 0 0 t t elsewhere. 0.8 0.6 0.4 0. 0 - -0. 0 3 4 BME 30 Biomedical Computing - 3
Time Shifting Continued Now let s time shifted it by seconds (delay), x(t)=s(t -) ( t - ) t - 4 x( t) (4 ( t )) 3 0 (8 3 t) 0 ( t ) t ( t ) t 4 elsewhere. 0.8 0.6 0.4 0. 0 - -0. 0 3 4 BME 30 Biomedical Computing - 33
Time Shifting Continued Now let s time shifted it by - seconds (advance), ( t ) x( t) (4 ( t 3 0 t )) ( 3 x(t)=s(t + ) t) 0 ( t ) t ( t ) t elsewhere. 0.8 0.6 0.4 0. 0 - -0. 0 3 4 BME 30 Biomedical Computing - 34
Time Shifting. 0.8 0.6 0.4 0. 0 - -0. 0 3 4 BME 30 Biomedical Computing - 3
Phase shift and Time Shift Time (seconds) xt () cos( 40 t ) f 40 Hz; Time shift = 0.006 s T 0.0 sec 40 phase shift: -0.0-0.087-0.0-0.006 0 0.006 0.0 0.087 0.0.. 0. 0 0-6.8-4.7-3.4 -.7 0.7 3.4 4.7 6.8-0. - 0. -0. - Phase shift = π / radians time shift: ts 0.006 sec 40 60 xt ( ) cos( 40( t0.006)) -. Radians -. BME 30 Biomedical Computing - 36
Phase and Time Shift x(t-t ) = A cos(ω o (t-t )) = A cos(ω o t+θ) A cos(ω o t-ω o t ) = A cos(ω o t+θ) ω o t-ω o t = ω o t+ϕ -ω o t = θ t = - θ / ω o = -ϕ /πf o θ= - πf o t =-π(t / T o ) Note that a positive (negative) value of t equates to a delay (advance) And a a positive (negative) value of θ equates to an advance (delay) BME 30 Biomedical Computing - 37
Phase and Time Shift Note that a positive (negative) value of t equates to a delay (advance) And a a positive (negative) value of θ equates to an advance (delay) x(t) = cos(π 0t + θ) θ = π / ; -π / t = - π / / (π 0) = -.00 sec; +.00 sec -0.0-0.0-0.00 0 0.00 0.0 0.0 0.0-0.0-0.0-0.00 0 0.00 0.0 0.0 0.0-0.0-0.0-0.00 0 0.00 0.0 0.0 0.0 - - - BME 30 Biomedical Computing - 38
Time shifting Shift = 0. 0. 0.7.0 seconds. 0. 0 - -0. 0 3 4 - -. BME 30 Biomedical Computing - 39
Periodicity of Sinusoids What happens when θ = π? When θ = π, then the sinusoidal waveform does not change since sinusoids are periodic in π Therefore, adding or subtracting multiple of π does not change the waveform This is called modulo π BME 30 Biomedical Computing - 40
Plotting Sinusoid Signals Case #: Delay x( t) 0 cos( (40) t 0.4 ) A 0, f 40Hz, 0.4 Basic Calculations o )Amplitude is ) Frequency 40Hz Calculation of T o f o 40 0.0sec 0 the Period msec 3) Phase angle/shift 0.4.664radians Calculation of the time shift ft 0 (40) t 0.4 0 t s s.4 0.00sec msec delay (40) t msec s Note that 0. T msec o phase angle 0.4 which also equals 0. s BME 30 Biomedical Computing - 4
Plotting Sinusoid Signals t ft + 0 cos ( ft+ ) -0.00-7.4 6.8-0.0-6.9 6.8-0.000-6.8 0.00-0.07 -.6 6.8-0.00 -.03 6.8-0.0-4.40-6.8-0.000-3.77-6.8-0.007-3.4-0.00-0.000 -. -6.8-0.00 -.88-6.8 0.0000 -.6 6.8 0.00-0.63 6.8 0.000 0.00 0.00 0.007 0.63 6.8 0.000.6 6.8 0.0.88-6.8 0.00. -6.8 0.07 3.4-0.00 0.000 3.77-6.8 0.0 4.40-6.8 0.00.03 6.8 0.07.6 6.8 0.0300 6.8 0.00 0.03 6.9 6.8 0.030 7.4 6.8 0.037 8.7-6.8 0.0400 8.80-6.8 0.04 9.4-0.00 0.040 0.0-6.8 0.047 0.68-6.8 0.000.3 6.8-0.0-0.0 0 0.0 0.0 0.03 0.04-0 -0-30 Time to the first (in positive time - delay) maximum is Time Shift = 0.00 sec => Negative Phase shift θ = -0.00*πf = -0.4π BME 30 Biomedical Computing - 30 0 0 0 cycle is the Period = 0.03-0.00 = 0.0 sec Since the period is 0.0, chose to plot the graph with 0 points per cycle or a Δ t of 0.00 seconds. 4
)Amplitude is ) Frequency 40Hz Calculation of T o f o 40 0.0sec Plotting Sinusoid Signals Case #: No Delay x( t) 0 cos( (40) t) A 0, f 40Hz, 0 0 the Period msec Basic Calculations o 3) Phase angle/shift 0 radians Calculation of the time shift ft s 0 (40)t s 0 0 t s 0 (40) 0sec BME 30 Biomedical Computing - 43
Plotting Sinusoid Signals t ft + 0 cos ( ft+ ) -0.00-6.8 0.00-0.0 -.6 6.8-0.000 -.03 6.8-0.07-4.40-6.8-0.00-3.77-6.8-0.0-3.4-0.00-0.000 -. -6.8-0.007 -.88-6.8-0.000 -.6 6.8-0.00-0.63 6.8 0.0000 0.00 0.00 0.00 0.63 6.8 0.000.6 6.8 0.007.88-6.8 0.000. -6.8 0.0 3.4-0.00 0.00 3.77-6.8 0.07 4.40-6.8 0.000.03 6.8 0.0.6 6.8 0.00 6.8 0.00 0.07 6.9 6.8 0.0300 7.4 6.8 0.03 8.7-6.8 0.030 8.80-6.8 0.037 9.4-0.00 0.0400 0.0-6.8 0.04 0.68-6.8 0.040.3 6.8 0.047.94 6.8 0.000.7 0.00 30.00 0.00 0.00 0.00-0.000-0.000 0.0000 0.000 0.000 0.0300 0.0400-0.00-0.00-30.00 cycle is the Period = 0.0 sec Time to the first maximum is Time Shift = 0 sec => Phase shift of θ = 0 Since the period is 0.0, chose to plot the graph with 0 points per cycle or a Δ t of 0.00 seconds. BME 30 Biomedical Computing - 44
)Amplitude is Calculation of f 0.0sec Plotting Sinusoid Signals Case #: Advance xt ( ) 0 cos( (40) t0.6 ) A0, fo 40 Hz, 0.6 Basic Calculations ) Frequency 40Hz T o o 40 0 the Period msec 3) Phase angle/shift 0.6.88radians Calculation of the time shift fts 0 (40) ts 0.6 0.6 ts 0.007sec 7.msec advance (40) t 7. msec s Note that 0.3 T msec which also equals o phase angle 0.6 0.3 BME 30 Biomedical Computing - 4
Plotting Sinusoid Signals t ft + 0 cos ( ft+ ) -0.00-4.40-6.8-0.0-3.77-6.8-0.000-3.4-0.00-0.07 -. -6.8-0.00 -.88-6.8-0.0 -.6 6.8-0.000-0.63 6.8-0.007 0.00 0.00-0.000 0.63 6.8-0.00.6 6.8 0.0000.88-6.8 0.00. -6.8 0.000 3.4-0.00 0.007 3.77-6.8 0.000 4.40-6.8 0.0.03 6.8 0.00.6 6.8 0.07 6.8 0.00 0.000 6.9 6.8 0.0 7.4 6.8 0.00 8.7-6.8 0.07 8.80-6.8 0.0300 9.4-0.00 0.03 0.0-6.8 0.030 0.68-6.8 0.037.3 6.8 0.0400.94 6.8 0.04.7 0.00 0.040 3.9 6.8 0.047 3.8 6.8 0.000 4.4-6.8 Time to the first maximum (in negative time - advance) is Time Shift = -0.007 sec => Positive Phase Shift θ = 0.007*πf = +0.6π 30.00 0.00 0.00 0.00-0.00-30.00 BME 30 Biomedical Computing - -0.000-0.000 0.0000 0.000 0.000 0.0300 0.0400-0.00 cycle is the Period = 0.03-0.00 = 0.0 sec Time to the first maximum (in positive time - delay) is Time Shift = +0.07 sec => Negative Phase Shift θ = 0.007*πf = -.4 Since the period is 0.0, chose to plot the graph with 0 points per cycle or a Δ t of 0.00 seconds. 46
Matlab Program to Plot Sinusoids function cosineplotphase(frequency,amplitude,phase,points,timestart,timeend); omega=*pi*frequency; Period=/Frequency; phase=phase; Timedelta=Period/Points; time = (Timestart:Timedelta:Timeend); y=amplitude*cos(omega*time+phase); plot(time,y,'r'); title('sinusoidal Plot'); xlabel('seconds'); axis([ Timestart Timeend -.*Amplitude +.*Amplitude]); BME 30 Biomedical Computing - 47
What s so important about Sinusoids and periodic signals? Are signals is nature periodic? Name some: Vibrations Voice Electromagnetic Biomedical So are signals is nature periodic? Not always but we may be able to model them with period signals Biomedical Research Summer Institute Examples: Measure blood viscosity Measure cell mass BME 30 Biomedical Computing - 48
Complex Numbers Complex numbers: What are they? What is the solution to this equation? ax +bx+c=0 This is a second order equation whose solution is: b b 4ac x, a BME 30 Biomedical Computing - 49
What is the solution to?. x +4x+3=0 x, 4 4 43 4 6 4 4 4, 3 BME 30 Biomedical Computing - 0
What is the solution to?. x +4x+=0 x, 4 4 4 4 6 0 4 4????? BME 30 Biomedical Computing -
What is the Square Root of a Negative Number? We define the square root of a negative number as an imaginary number We define x for engineers ( i Then our solution becomes:, 4 4 4 4 4 4 4 4 BME 30 Biomedical Computing - for mathematicans) 6 0 4,
The Complex Plane z= x+yis a complex number where: x= Re{z} is the real part of z y= Im{z} is the imaginary part of z We can define the complex plane and we can define representations for a complex number: Im{z} y z = x+y (x,y) x Re{z} BME 30 Biomedical Computing - 3
Rectangular Form Rectangular (or cartesian) form of a complex number is given as z= x+y x= Re{z} is the real part of z y= Im{z} is the imaginary part of z Im{z} y z = x+y (x,y) x Re{z} Rectangular or Cartesian BME 30 Biomedical Computing - 4
z= re θ = r Polar Form θ is a complex number where: r is the magnitude of z θ is the angle or argument of z (arg z) Im{z} y z= re θ Polar (r,) r x Re{z} BME 30 Biomedical Computing -
Relationships between the Polar and Rectangular Forms z= x+ y= re θ Relationship of Polar to the Rectangular Form: x= Re{z} = r cos θ y= Im{z} = r sin θ Relationship of Rectangular to Polar Form: r x y and arctan( y x ) BME 30 Biomedical Computing - 6
Addition of complex numbers When two complex numbers are added, it is best to use the rectangular form. The real part of the sum is the sum of the real parts and imaginary part of the sum is the sum of the imaginary parts. y y Im Example: z 3 = z + z z z 3 x ( x x z x x y z ) ; z y x ( y x y y y ) y x y BME 30 Biomedical Computing - z y y z x x x z x Re 7
Multiplication of complex numbers When two complex numbers are multiplied, it is best to use the polar form: ( ) ( ) Example: z 3 = z x z z re ; z r e 3 ( ) ( ) We multiply the magnitudes and add the phase angles θ 3 = θ + θ Im z z rr e ( ) r z e re ( ) rr e r e ( ) r 3 = r r r θ θ BME 30 Biomedical Computing - Re 8
e Some examples e cos( ) sin( ) 0 e cos( ) sin( ) 0 e cos( ) sin( ) cos( ) sin( ) 0 tan ( ) e ( ) ( ) e 3 4 e Im Re BME 30 Biomedical Computing - 9
BME 30 Biomedical Computing - 60 Some examples 4 e e ) sin( ) cos( ) 4 sin( ) 4 cos( 4 e e 0.8.4 tan (.4) tan ) 3.36 8.36 ( tan 9.4 84.367 7.86. 8.36 3.36 8.36 3.36 e e e e.707
BME 30 Biomedical Computing - 6 Some examples ) sin( ) cos( ) 4 sin( ) 4 cos( 4 e e.707 0.707.707 0.8.8.8 (.4) tan ).707.707 ( tan 9.4.8 3.4.9 0..707 0.707 e e e e e OR
Some examples e 4 e 9. 4 Im e.8 Re BME 30 Biomedical Computing - 6
Euler s Formula e θ = cos θ + sin θ Im{z} θ Re{z} We can use Euler s Formula to define complex numbers z = r e θ = r cos θ + r sin θ = x + y BME 30 Biomedical Computing - 63
Complex Exponential Signals A complex exponential signal is define as: ( t ) zt () Ae o Note that it is defined in polar form where the magnitude of z(t) is z(t) = A the angle (or argument, arg z(t) ) of z(t) = (ω o t + θ) Where ω o is called the radian frequency and θ is the phase angle (phase shift) BME 30 Biomedical Computing - 64
Complex Exponential Signals Note that by using Euler s formula, we can rewrite the complex exponential signal in rectangular form as: zt () Ae ( t) o Acos( t ) Asin( t ) o o Therefore real part is the cosine signal and imaginary part is a sine signal both of radial frequency ω o and phase angle of θ BME 30 Biomedical Computing - 6
Plotting the waveform of a complex exponential signal For an complex signal, we plot the real part and the imaginary part separately. Example: z(t) = 0e (π(40)t-0.4π) = 0e (80πt-0.4π) = 0 cos(80πt-0.4π) + 0 sin(80πt-0.4π) real part 0 0 0-0.03-0.0-0.0-0 0.0 0.0 0.03 0.04-0 - -0 imaginary part 0 0 0-0.03-0.0-0.0-0 0.0 0.0 0.03 0.04-0 - -0 BME 30 Biomedical Computing - 66
NOTE!!!! The reason why we prefer the complex exponential representation of the real cosine signal: ( t) xt () ezt {()} eae { o } Acos( t ) In solving equations and making other calculations, it easier to use the complex exponential form and then take the Real Part. o BME 30 Biomedical Computing - 67
Homework Exercises:.. Problems: -. Instead plot x(t) cos( t ) for t 0 0 Plot x(t) using Matlab; as part of your answer provide your code -. -.3a,.3b =0.4, Plot these functions using Matlab; as part of your answer provide your code -.4 BME 30 Biomedical Computing - 68