1 Prof. Nizamettin AYDIN Advanced Digital Signal Processing 30/09/14
2 Some basics: Sinusoids
3 What’s a signal A signal can be defined as –a pattern of variations of a physical quantity that can be manipulated, stored, or transmitted by physical process. –an information variable represented by physical quantity. For digital systems, the variable takes on discrete values. In the mathematical sense it is a function of time, x(t), that carries an information.
4 TUNING FORK A-440 Waveform Time (sec)
5 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
6 Speech Signal: BAT PeriodicNearly Periodic in Vowel Region –Period is (Approximately) T = sec
7 One-dimensional continuous-time signal This speech signal is an example of one- dimensional continuous-time signal. Can be represented mathematically as a function of single independent variable (t).
8 Two-dimensional stationary signal This is a two dimensional signal (an image) A spatial pattern not varying in time Represented mathematically as a function of two spatial variables (x,y) However, videos are time- varying images that involves three independent variables (x,y,t)
9 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 F samp )
10 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 = Mbytes
11 SINE and COSINE functions
12 Always use the COSINE FORM Sine is a special case: SINES and COSINES
13 SINUSOIDAL SIGNAL FREQUENCY –Radians/sec –Hertz (cycles/sec) PERIOD (in sec) AMPLITUDE –Magnitude PHASE
14 EXAMPLE of SINUSOID Given the Formula Make a plot
15 PLOT COSINE SIGNAL Formula defines A, , and
16 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
17 PLOT the SINUSOID Use T=20/3 and the peak location at t=-4
18 TIME-SHIFT In a mathematical formula we can replace t with t-t m Then the t=0 point moves to t=t m Peak value of cos( (t-t m )) is now at t=t m
19 TIME-SHIFTED SINUSOID
20 PHASE TIME-SHIFT Equate the formulas: and we obtain: or,
21 TIME-SHIFT Whenever a signal can be expressed in the form x 1 (t)=s(t-t 1 ), we say that x 1 (t) is time shifted version of s(t) –If t 1 is a + number, then the shift is to the right, and we say that the signal s(t) has been delayed in time. –If t 1 is a - number, then the shift is to the left, and we say that the signal s(t) was advanced in time.
22 SINUSOID from a PLOT Measure the period, T –Between peaks or zero crossings –Compute frequency: = 2 /T Measure time of a peak: t m –Compute phase: = - t m Measure height of positive peak: A 3 steps
23 (A, , ) from a PLOT
24 PHASE is AMBIGUOUS The cosine signal is periodic – Period is 2 –Thus adding any multiple of 2 leaves x(t) unchanged
25 COMPLEX NUMBERS To solve: z 2 = -1 – z = j – Math and Physics use z = i Complex number: z = x + j y x yz Cartesian coordinate system
26 PLOT COMPLEX NUMBERS
27 COMPLEX ADDITION = VECTOR Addition
28 *** POLAR FORM *** Vector Form –Length =1 –Angle = Common Values 1 has angle of j has angle of 0.5 1 has angle of j has angle of 1.5 also, angle of j could be 0.5 1.5 2 because the PHASE is AMBIGUOUS
29 POLAR RECTANGULAR Relate (x,y) to (r, ) Need a notation for POLAR FORM Most calculators do Polar-Rectangular
30 Euler’s FORMULA Complex Exponential –Real part is cosine –Imaginary part is sine –Magnitude is one
31 COMPLEX EXPONENTIAL Interpret this as a Rotating Vector t Angle changes vs. time ex: rad/s Rotates in 0.01 secs
32 cos = REAL PART Real Part of Euler’s General Sinusoid So,
33 REAL PART EXAMPLE Answer: Evaluate:
34 COMPLEX AMPLITUDE Then, any Sinusoid = REAL PART of Xe j t General Sinusoid Complex AMPLITUDE = X
35 TRIG FUNCTIONS Circular Functions Common Values –sin(k ) = 0 –cos(0) = 1 –cos(2k ) = 1 and cos((2k+1) ) = -1 –cos((k+0.5) ) = 0
36 Basic properties of the sine and cosine functions
37 Some basic trigonometric identities
38 Sampling and plotting sinusoids Plot the following function Must evaluate x(t) at a discrete set of times, t n =nT s, where n is an integer T s is called sample spacing or sampling period Matlab or Scilab program.MatlabScilab Hypersignal
39
40 SPECTRUM Representation Sinusoids with DIFFERENT Frequencies –SYNTHESIZE by Adding Sinusoids SPECTRUM Representation DIFFERENT –Graphical Form shows DIFFERENT Freqs
41 FREQUENCY DIAGRAM Plot Complex Amplitude vs. Freq –100–250 f (in Hz)
42 Another FREQ. Diagram Frequency is the vertical axis Time is the horizontal axis A-440
43 MOTIVATION Synthesize Complicated Signals –Musical Notes Piano uses 3 strings for many notes Chords: play several notes simultaneously –Human Speech Vowels have dominant frequencies Application: computer generated speech –Can all signals be generated this way? Sum of sinusoids?
44 Fur Elise WAVEFORM Beat Notes
45 Speech Signal: BAT PeriodicNearly Periodic in Vowel Region –Period is (Approximately) T = sec
46 Euler’s Formula Reversed Solve for cosine (or sine)
47 INVERSE Euler’s Formula Solve for cosine (or sine)
48 SPECTRUM Interpretation Cosine = sum of 2 complex exponentials: One has a positive frequency The other has negative freq. Amplitude of each is half as big
49 NEGATIVE FREQUENCY Is negative frequency real? Doppler Radar provides an example –Police radar measures speed by using the Doppler shift principle –Let’s assume 400Hz 60 mph –+400Hz means towards the radar –-400Hz means away (opposite direction) –Think of a train whistle
50 SPECTRUM of SINE Sine = sum of 2 complex exponentials: –Positive freq. has phase = -0.5 –Negative freq. has phase = +0.5
51 GRAPHICAL SPECTRUM EXAMPLE of SINE AMPLITUDE, PHASE & FREQUENCY are shown 7-70
52 SPECTRUM ---> SINUSOID Add the spectrum components: What is the formula for the signal x(t)? –100–250 f (in Hz)
53 Gather (A, ) information Frequencies: –-250 Hz –-100 Hz –0 Hz –100 Hz –250 Hz Amplitude & Phase –4- /2 –7+ /3 –100 –7- /3 –4+ /2 DC is another name for zero-freq component DC component always has or (for real x(t) ) Note the conjugate phase
54 Add Spectrum Components-1 Amplitude & Phase –4 - /2 –7 + /3 –100 –7 - /3 –4 + /2 Frequencies: –-250 Hz –-100 Hz –0 Hz –100 Hz –250 Hz
55 Add Spectrum Components –100–250 f (in Hz)
56 Use Euler’s Formula to get REAL sinusoids: Simplify Components
57 FINAL ANSWER So, we get the general form:
58 Summary: GENERAL FORM
59 Example: Synthetic Vowel Sum of 5 Frequency Components
60 SPECTRUM of VOWEL –Note: Spectrum has 0.5X k (except X DC ) –Conjugates in negative frequency
61 SPECTRUM of VOWEL (Polar Format) kk 0.5A k
62 Vowel Waveform (sum of all 5 components)
63 Periodic Signals, Harmonics & Time-Varying Sinusoids
64 Problem Solving Skills Math Formula –Sum of Cosines –Amp, Freq, Phase Recorded Signals –Speech –Music –No simple formula Plot & Sketches –S(t) versus t –Spectrum MATLAB –Numerical –Computation –Plotting list of numbers
65 HARMONICSignals with HARMONIC Frequencies –Add Sinusoids with f k = kf 0 FREQUENCY can change vs. TIME Chirps: Introduce Spectrogram Visualization (specgram.m)
66 SPECTRUM DIAGRAM Recall Complex Amplitude vs. Freq –100–250 f (in Hz)
67 SPECTRUM for PERIODIC ? Nearly Periodic in the Vowel Region –Period is (Approximately) T = sec
68 PERIODIC SIGNALS Repeat every T secs –Definition –Example: –Speech can be “quasi-periodic”
69 Period of Complex Exponential Definition: Period is T k = integer
70 Harmonic Signal Spectrum
71 Define FUNDAMENTAL FREQ
72 What is the fundamental frequency? Harmonic Signal (3 Freqs) 3rd 5th 10 Hz
73 Example Here’s another spectrum: What is the fundamental frequency? 100 Hz ?50 Hz ? –100–250 f (in Hz)
74 SPECIAL RELATIONSHIP to get a PERIODIC SIGNAL IRRATIONAL SPECTRUM
75 Harmonic Signal (3 Freqs) T=0.1
76 NON-Harmonic Signal NOT PERIODIC
77 FREQUENCY ANALYSIS Now, a much HARDER problemNow, a much HARDER problem Given a recording of a song, have the computer write the music Can a machine extract frequencies? –Yes, if we COMPUTE the spectrum for x(t) During short intervals
78 Time-Varying FREQUENCIES Diagram Frequency is the vertical axis Time is the horizontal axis A-440
79 SIMPLE TEST SIGNAL C-major SCALE: stepped frequencies –Frequency is constant for each note IDEAL
80 SPECTROGRAM SPECTROGRAM Tool –MATLAB function is specgram.m –SP-First has plotspec.m & spectgr.m ANALYSIS program –Takes x(t) as input & –Produces spectrum values X k –Breaks x(t) into SHORT TIME SEGMENTS Then uses the FFT (Fast Fourier Transform)
81 SPECTROGRAM EXAMPLE Two Constant Frequencies: Beats
82 AM Radio Signal Same as BEAT Notes
83 SPECTRUM of AM (Beat) 4 complex exponentials in AM: What is the fundamental frequency? 648 Hz ?24 Hz ? f (in Hz) –672 –648
84 STEPPED FREQUENCIES C-major SCALE: successive sinusoids –Frequency is constant for each note IDEAL
85 SPECTROGRAM of C-Scale ARTIFACTS at Transitions Sinusoids ONLY From SPECGRAM ANALYSIS PROGRAM
86 Spectrogram of LAB SONG ARTIFACTS at Transitions Sinusoids ONLY Analysis Frame = 40ms
87 Time-Varying Frequency Frequency can change vs. time –Continuously, not stepped FREQUENCY MODULATION (FM)FREQUENCY MODULATION (FM) CHIRP SIGNALS –Linear Frequency Modulation (LFM) VOICE
88 New Signal: Linear FM Called Chirp Signals (LFM) –Quadratic phase Freq will change LINEARLY vs. time –Example of Frequency Modulation (FM) –Define “instantaneous frequency” QUADRATIC
89 INSTANTANEOUS FREQ Definition For Sinusoid: Derivative of the “Angle” Makes sense
90 INSTANTANEOUS FREQ of the Chirp Chirp Signals have Quadratic phase Freq will change LINEARLY vs. time
91 CHIRP SPECTROGRAM
92 CHIRP WAVEFORM
93 OTHER CHIRPS (t) can be anything: (t) could be speech or music: –FM radio broadcast
94 SINE-WAVE FREQUENCY MODULATION (FM)