cmpe 362 Signal Processing Instructor Fatih Alagz Assistant

  • Slides: 69
Download presentation
cmpe 362 - Signal Processing Instructor: Fatih Alagöz Assistant: Yekta Sait Can

cmpe 362 - Signal Processing Instructor: Fatih Alagöz Assistant: Yekta Sait Can

What is Signal? § Signal is the variation of a physical phenomenon / quantity

What is Signal? § Signal is the variation of a physical phenomenon / quantity with respect to one or more independent variable § A signal is a function. Example 1: Voltage on a capacitor as a function of time. + RC circuit 2

What is Signal? Example 2: Two different vocoder signals of “Otuz yedi derece” male/female,

What is Signal? Example 2: Two different vocoder signals of “Otuz yedi derece” male/female, emotion, background noise, any aspects of vocoder functionallity. Have you had something spicy, salty, sour just before you say it; function of everything !!! 3

What is Signal? Example 3 : Closing value of the stock exchange index as

What is Signal? Example 3 : Closing value of the stock exchange index as a function of days Example 4: Image as a function of x-y coordinates (e. g. 256 X 256 pixel image) Index MT W T F S S Fig. Stock exchange 4

What is Signal Processing §Process signal(s) for solving many scientific/ engineering/ theoretical purposes §The

What is Signal Processing §Process signal(s) for solving many scientific/ engineering/ theoretical purposes §The process is includes calculus, Differential equations, Difference equations, Transform theory, Linear time-invariant system theory, System identification and classification, Time-frequency analysis, Spectral estimation, Vector spaces and Linear algebra, Functional analysis, statistical signals and stochastic processes, Detection theory, Estimation theory, Optimization, Numerical methods, Time series, Data mining, etc §“The IEEE Transactions on Signal Processing covers novel theory, algorithms, performance analyses and applications of techniques for the processing, understanding, learning, retrieval, mining, and extraction of information from signals. The term "signal" includes, among others, audio, video, speech, image, communication, geophysical, sonar, radar, medical and musical signals. Examples of topics of interest include, but are not limited to, information processing and theory and application of filtering, coding, transmitting, estimating, detecting, analyzing, recognizing, synthesizing, recording, and reproducing signals” REFERENCE: IEEE Transactions on Signal Processing Journal 5

Signal Processing everywhere x(n) or x(t) INPUT SIGNAL § § § § § y(n)

Signal Processing everywhere x(n) or x(t) INPUT SIGNAL § § § § § y(n) or SYSTEM (PROCESS)y(t) OUTPUT SIGNAL Audio, speech, image, video Ranging from nanoscale to deepspace communications Sonar, radar, geosensing Array processing, Control systems (all industry) Seismology, Meteorology, Finance, Health, etc. . IT IS GOOD TO KNOW THIS COURSE 6

I am currently working on gender classification problem for chicken hatchery eggs DİŞİ FTIR

I am currently working on gender classification problem for chicken hatchery eggs DİŞİ FTIR (Fourier Transform Infrared Spectrometer) yöntemi ile allantoik sıvının kimyasal bileşenine (östrojen seviyesi gibi) duyarlı frekans bandındaki (kırmızı bant) ışığın soğurulma oranına dayalı olarak yumurtadaki östrojen miktarı yumurtaya zarar vermeden (uzaktan) saptanabilir. ERKEK 7

The course in a single slide 8

The course in a single slide 8

ALL ABOUT THREE DOMAINS Use H(z) to get Freq. Response TIME-DOMAIN 10/16/2021 9 Z-TRANSFORM-DOMAIN:

ALL ABOUT THREE DOMAINS Use H(z) to get Freq. Response TIME-DOMAIN 10/16/2021 9 Z-TRANSFORM-DOMAIN: poles & zeros POLYNOMIALS: H(z) FREQ-DOMAIN

Lets start from the beginning. . . Signals… 10

Lets start from the beginning. . . Signals… 10

Signal Processing First LECTURE #1 Sinusoids

Signal Processing First LECTURE #1 Sinusoids

READING ASSIGNMENTS § This Lecture: § Chapter 2, Sects. 2 -1 to 2 -5

READING ASSIGNMENTS § This Lecture: § Chapter 2, Sects. 2 -1 to 2 -5 § Appendix A: Complex Numbers § Appendix B: MATLAB § Chapter 1: Introduction 10/16/2021 2003 rws/j. Mc 12

LECTURE OBJECTIVES § Write general formula for a “sinusoidal” waveform, or signal § From

LECTURE OBJECTIVES § Write general formula for a “sinusoidal” waveform, or signal § From the formula, plot the sinusoid versus time § What’s a signal? § It’s a function of time, x(t) § in the mathematical sense 10/16/2021 2003 rws/j. Mc 13

TUNING FORK EXAMPLE § § § CD-ROM demo “A” is at 440 Hertz (Hz)

TUNING FORK EXAMPLE § § § CD-ROM demo “A” is at 440 Hertz (Hz) Waveform is a SINUSOIDAL SIGNAL Computer plot looks like a sine wave This should be the mathematical formula: 10/16/2021 2003 rws/j. Mc 14

SINUSOID AMPLITUDE EXAMPLES 1 -)0. 25*sin(2π*300 t) 2 -)0. 50*sin(2π*300 t) 3 -)1. 00*sin(2π*300

SINUSOID AMPLITUDE EXAMPLES 1 -)0. 25*sin(2π*300 t) 2 -)0. 50*sin(2π*300 t) 3 -)1. 00*sin(2π*300 t) Different Amplitude Sound Examples Amplitude = Asin(2π*300 t) Amplitude = 5*Asin(2π*300 t) 10/16/2021 Amplitude =10*A sin(2π*300 t) 15

SINUSOID FREQUENCY EXAMPLES 1 -)1. 00 sin(2π*300 t) 2 -)1. 00*sin(2π*600 t) 3 -)1.

SINUSOID FREQUENCY EXAMPLES 1 -)1. 00 sin(2π*300 t) 2 -)1. 00*sin(2π*600 t) 3 -)1. 00*sin(2π*1200 t) Different Amplitude Sound Examples Amplitude = 1. 00 sin(2π*300 t) Amplitude = 1. 00 sin(2π*600 t) 10/16/2021 Amplitude = 1. 00 sin(2π*1200 t) 16

SINUSOID PHASE EXAMPLES 1 -)1. 00 sin(2π*300 t) 2 -)1. 00*sin(2π*300 t+ π/2) 3

SINUSOID PHASE EXAMPLES 1 -)1. 00 sin(2π*300 t) 2 -)1. 00*sin(2π*300 t+ π/2) 3 -)1. 00*sin(2π*300 t+ π) 10/16/2021 17

HUMAN VOICE WITH DIFFERENT SAMPLING FREQUENCIES ØWith the original sampling frequency Fs ØWhen sampled

HUMAN VOICE WITH DIFFERENT SAMPLING FREQUENCIES ØWith the original sampling frequency Fs ØWhen sampled with Fs/2 ØWhen sampled with 2*Fs ØWhen sampled with 5*Fs 10/16/2021 18

TIME VS FREQUENCY REPRESENTATION OF ONE CLAP RECORD(SPECTROGRAM) 10/16/2021 19

TIME VS FREQUENCY REPRESENTATION OF ONE CLAP RECORD(SPECTROGRAM) 10/16/2021 19

TIME VS FREQUENCY REPRESENTATION OF TWO CLAPS RECORD (SPECTROGRAM) 10/16/2021 20

TIME VS FREQUENCY REPRESENTATION OF TWO CLAPS RECORD (SPECTROGRAM) 10/16/2021 20

TIME VS FREQUENCY REPRESENTATION OF CLAP + SNAP RECORD (SPECTROGRAM) (FIRST CLAP THEN FINGER

TIME VS FREQUENCY REPRESENTATION OF CLAP + SNAP RECORD (SPECTROGRAM) (FIRST CLAP THEN FINGER SNAP) 10/16/2021 21

TUNING FORK A-440 Waveform Time (sec) 10/16/2021 2003 rws/j. Mc 22

TUNING FORK A-440 Waveform Time (sec) 10/16/2021 2003 rws/j. Mc 22

SPEECH EXAMPLE § More complicated signal (BAT. WAV) § Waveform x(t) is NOT a

SPEECH EXAMPLE § More complicated signal (BAT. WAV) § Waveform x(t) is NOT a Sinusoid § Theory will tell us § x(t) is approximately a sum of sinusoids § FOURIER ANALYSIS § Break x(t) into its sinusoidal components § Called the FREQUENCY SPECTRUM 10/16/2021 2003 rws/j. Mc 23

Speech Signal: BAT § Nearly Periodic in Vowel Region § Period is (Approximately) T

Speech Signal: BAT § Nearly Periodic in Vowel Region § Period is (Approximately) T = 0. 0065 sec 10/16/2021 2003 rws/j. Mc 24

DIGITIZE the WAVEFORM § x[n] is a SAMPLED SINUSOID § A list of numbers

DIGITIZE the WAVEFORM § x[n] is a SAMPLED SINUSOID § A list of numbers stored in memory § Sample at 11, 025 samples per second § Called the SAMPLING RATE of the A/D § Time between samples is § 1/11025 = 90. 7 microsec § Output via D/A hardware (at Fsamp) 10/16/2021 2003 rws/j. Mc 25

STORING DIGITAL SOUND § x[n] is a SAMPLED SINUSOID § A list of numbers

STORING DIGITAL SOUND § x[n] is a SAMPLED SINUSOID § A list of numbers stored in memory § § CD rate is 44, 100 samples per second 16 -bit samples Stereo uses 2 channels Number of bytes for 1 minute is § 2 X (16/8) X 60 X 44100 = 10. 584 Mbytes 10/16/2021 2003 rws/j. Mc 26

SINUSOIDAL SIGNAL § FREQUENCY § Radians/sec § Hertz (cycles/sec) § PERIOD (in sec) 10/16/2021

SINUSOIDAL SIGNAL § FREQUENCY § Radians/sec § Hertz (cycles/sec) § PERIOD (in sec) 10/16/2021 § AMPLITUDE § Magnitude § PHASE 2003 rws/j. Mc 27

EXAMPLE of SINUSOID § Given the Formula § Make a plot 10/16/2021 2003 rws/j.

EXAMPLE of SINUSOID § Given the Formula § Make a plot 10/16/2021 2003 rws/j. Mc 28

PLOT COSINE SIGNAL § Formula defines A, w, and f 10/16/2021 2003 rws/j. Mc

PLOT COSINE SIGNAL § Formula defines A, w, and f 10/16/2021 2003 rws/j. Mc 29

PLOTTING COSINE SIGNAL from the FORMULA § Determine period: § Determine a peak location

PLOTTING COSINE SIGNAL from the FORMULA § Determine period: § Determine a peak location by solving § Zero crossing is T/4 before or after § Positive & Negative peaks spaced by T/2 10/16/2021 2003 rws/j. Mc 30

PLOT the SINUSOID § Use T=20/3 and the peak location at t=-4 10/16/2021 2003

PLOT the SINUSOID § Use T=20/3 and the peak location at t=-4 10/16/2021 2003 rws/j. Mc 31

PLOTTING COSINE SIGNAL from the FORMULA § Determine period: § Determine a peak location

PLOTTING COSINE SIGNAL from the FORMULA § Determine period: § Determine a peak location by solving § Peak at t=-4 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 33

ANSWER for the PLOT § Use T=20/3 and the peak location at t=-4 10/16/2021

ANSWER for the PLOT § Use T=20/3 and the peak location at t=-4 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 34

TIME-SHIFT § In a mathematical formula we can replace t with t-tm § Then

TIME-SHIFT § In a mathematical formula we can replace t with t-tm § Then the t=0 point moves to t=tm § Peak value of cos(w(t-tm)) is now at t=tm 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 35

TIME-SHIFTED SINUSOID 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 36

TIME-SHIFTED SINUSOID 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 36

PHASE <--> TIME-SHIFT § Equate the formulas: § and we obtain: § or, 10/16/2021

PHASE <--> TIME-SHIFT § Equate the formulas: § and we obtain: § or, 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 37

SINUSOID from a PLOT § Measure the period, T § Between peaks or zero

SINUSOID from a PLOT § Measure the period, T § Between peaks or zero crossings § Compute frequency: w = 2 p/T 3 steps § Measure time of a peak: tm § Compute phase: f = -w tm § Measure height of positive peak: A 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 38

(A, w, f) from a PLOT 10/16/2021 © 2003, JH Mc. Clellan & RW

(A, w, f) from a PLOT 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 39

SINE DRILL (MATLAB GUI) 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 40

SINE DRILL (MATLAB GUI) 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 40

PHASE § The cosine signal is periodic § Period is 2 p § Thus

PHASE § The cosine signal is periodic § Period is 2 p § Thus adding any multiple of 2 p leaves x(t) unchanged 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 41

COMPLEX NUMBERS § To solve: z 2 = -1 §z=j § Math and Physics

COMPLEX NUMBERS § To solve: z 2 = -1 §z=j § Math and Physics use z = i § Complex number: z = x + j y y z x 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer Cartesian coordinate system 42

PLOT COMPLEX NUMBERS 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 43

PLOT COMPLEX NUMBERS 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 43

COMPLEX ADDITION = VECTOR Addition 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer

COMPLEX ADDITION = VECTOR Addition 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 44

*** POLAR FORM *** § Vector Form § Length =1 § Angle = q

*** POLAR FORM *** § Vector Form § Length =1 § Angle = q § Common Values § j has angle of 0. 5 p § -1 has angle of p § - j has angle of 1. 5 p § also, angle of -j could be -0. 5 p = 1. 5 p -2 p § because the PHASE is AMBIGUOUS 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 45

POLAR <--> RECTANGULAR § Relate (x, y) to (r, q) Most calculators do Polar-Rectangular

POLAR <--> RECTANGULAR § Relate (x, y) to (r, q) Most calculators do Polar-Rectangular Need a notation for POLAR FORM 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 46

Euler’s FORMULA § Complex Exponential § Real part is cosine § Imaginary part is

Euler’s FORMULA § Complex Exponential § Real part is cosine § Imaginary part is sine § Magnitude is one 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 47

COMPLEX EXPONENTIAL § Interpret this as a Rotating Vector § § 10/16/2021 q =

COMPLEX EXPONENTIAL § Interpret this as a Rotating Vector § § 10/16/2021 q = wt Angle changes vs. time ex: w=20 p rad/s Rotates 0. 2 p in 0. 01 secs © 2003, JH Mc. Clellan & RW Schafer 48

cos = REAL PART Real Part of Euler’s General Sinusoid So, 10/16/2021 © 2003,

cos = REAL PART Real Part of Euler’s General Sinusoid So, 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 49

REAL PART EXAMPLE Evaluate: Answer: 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer

REAL PART EXAMPLE Evaluate: Answer: 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 50

COMPLEX AMPLITUDE General Sinusoid Complex AMPLITUDE = X Then, any Sinusoid = REAL PART

COMPLEX AMPLITUDE General Sinusoid Complex AMPLITUDE = X Then, any Sinusoid = REAL PART of Xejwt 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 51

Z DRILL (Complex Arith) 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 52

Z DRILL (Complex Arith) 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 52

AVOID Trigonometry § Algebra, even complex, is EASIER !!! § Can you recall cos(q

AVOID Trigonometry § Algebra, even complex, is EASIER !!! § Can you recall cos(q 1+q 2) ? (q +q ) j 1 2 § Use: real part of e = cos(q +q ) 1 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 2 53

Euler’s FORMULA § Complex Exponential § Real part is cosine § Imaginary part is

Euler’s FORMULA § Complex Exponential § Real part is cosine § Imaginary part is sine § Magnitude is one 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 54

Real & Imaginary Part Plots PHASE DIFFERENCE 10/16/2021 = p/2 © 2003, JH Mc.

Real & Imaginary Part Plots PHASE DIFFERENCE 10/16/2021 = p/2 © 2003, JH Mc. Clellan & RW Schafer 55

COMPLEX EXPONENTIAL § Interpret this as a Rotating Vector § § 10/16/2021 q =

COMPLEX EXPONENTIAL § Interpret this as a Rotating Vector § § 10/16/2021 q = wt Angle changes vs. time ex: w=20 p rad/s Rotates 0. 2 p in 0. 01 secs © 2003, JH Mc. Clellan & RW Schafer 56

Rotating Phasor See Demo on CD-ROM Chapter 2 10/16/2021 © 2003, JH Mc. Clellan

Rotating Phasor See Demo on CD-ROM Chapter 2 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 57

Cos = REAL PART Real Part of Euler’s General Sinusoid So, 10/16/2021 © 2003,

Cos = REAL PART Real Part of Euler’s General Sinusoid So, 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 58

COMPLEX AMPLITUDE General Sinusoid = REAL PART of (Aejf)ejwt Complex AMPLITUDE = X 10/16/2021

COMPLEX AMPLITUDE General Sinusoid = REAL PART of (Aejf)ejwt Complex AMPLITUDE = X 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 59

POP QUIZ: Complex Amp § Find the COMPLEX AMPLITUDE for: § Use EULER’s FORMULA:

POP QUIZ: Complex Amp § Find the COMPLEX AMPLITUDE for: § Use EULER’s FORMULA: 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 60

WANT to ADD SINUSOIDS § ALL SINUSOIDS have SAME FREQUENCY § HOW to GET

WANT to ADD SINUSOIDS § ALL SINUSOIDS have SAME FREQUENCY § HOW to GET {Amp, Phase} of RESULT ? 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 61

ADD SINUSOIDS § Sum Sinusoid has SAME Frequency 10/16/2021 © 2003, JH Mc. Clellan

ADD SINUSOIDS § Sum Sinusoid has SAME Frequency 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 62

PHASOR ADDITION RULE Get the new complex amplitude by complex addition 10/16/2021 © 2003,

PHASOR ADDITION RULE Get the new complex amplitude by complex addition 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 63

Phasor Addition Proof 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 64

Phasor Addition Proof 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 64

POP QUIZ: Add Sinusoids § ADD THESE 2 SINUSOIDS: § COMPLEX ADDITION: 10/16/2021 ©

POP QUIZ: Add Sinusoids § ADD THESE 2 SINUSOIDS: § COMPLEX ADDITION: 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 65

POP QUIZ (answer) § COMPLEX ADDITION: § CONVERT back to cosine form: 10/16/2021 ©

POP QUIZ (answer) § COMPLEX ADDITION: § CONVERT back to cosine form: 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 66

ADD SINUSOIDS EXAMPLE tm 1 tm 2 tm 3 10/16/2021 © 2003, JH Mc.

ADD SINUSOIDS EXAMPLE tm 1 tm 2 tm 3 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 67

Convert Time-Shift to Phase § Measure peak times: § tm 1=-0. 0194, tm 2=-0.

Convert Time-Shift to Phase § Measure peak times: § tm 1=-0. 0194, tm 2=-0. 0556, tm 3=-0. 0394 § Convert to phase (T=0. 1) § f 1=-wtm 1 = -2 p(tm 1 /T) = 70 p/180, § f 2= 200 p/180 § Amplitudes § A 1=1. 7, A 2=1. 9, A 3=1. 532 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 68

Phasor Add: Numerical § Convert Polar to Cartesian § X 1 = 0. 5814

Phasor Add: Numerical § Convert Polar to Cartesian § X 1 = 0. 5814 + j 1. 597 § X 2 = -1. 785 - j 0. 6498 § sum = § X 3 = -1. 204 + j 0. 9476 § Convert back to Polar § X 3 = 1. 532 at angle 141. 79 p/180 § This is the sum 10/16/2021 © 2003, JH Mc. Clellan & RW Schafer 69

ADD SINUSOIDS X 1 VECTOR (PHASOR) ADD 10/16/2021 X 3 X 2 © 2003,

ADD SINUSOIDS X 1 VECTOR (PHASOR) ADD 10/16/2021 X 3 X 2 © 2003, JH Mc. Clellan & RW Schafer 70