Introduction to Digital Signal Processing (Discrete-time Signal Processing) Prof. Chu-Song Chen Research Center for Info. Tech. Innovation, Academia Sinica, Taiwan Dept. CSIE & GINM National Taiwan University Fall 2012 Course Information • Teaching assistant: – Yin-Tzu Lin 林映孜 known@cmlab.csie.ntu.edu.tw • Course webpage – www.cmlab.csie.ntu.edu.tw/~dsp/dsp2012 • Grades – Homework x 2 (30%) – Test x 2 (40%) – Term project (30%) Review of Complex Exponential Real and Image Parts: Phase Difference is /2 Analogous to Uniform Circular Motion Time axis Advantage in computation Basis Functions • Remember that, sinusoids (such as sine) can serve as orthogonal bases for representing signals. • But, why not using sinusoids directly as basis functions in signals and linear systems? Basis Functions in Signals and Systems • In signal processing, we hope that each basis function corresponds to a frequency, so that a signal can be decomposed into different frequency components. • However, when the frequency is chosen, there are still various phases φ corresponding to this frequency. cos(w0t+φ) • Eg., when the frequency is fixed to be w0 in a cosine function, what is the phase φ that should be chosen to serve as a basis? • Otherwise, do we need to use all the phases as basis functions? (seems to be redundant) Complex Exponentials Serving as Basis Functions • Linear combination: coefficients Bases • Can we simply use zero-phase functions as bases? • This cannot be achieved easily by sinusoid. • For example, if we use zero-phase sine functions {sin(t) | R} as bases, the functions f we can represent is restrict to those satisfies f(0)=0, because sin(0)=0 and so the linear combination of zero-phase sine functions is always zero. Why choosing complex exponential? • Nevertheless, it can be shown that we can use ejt as bases. That is, ej(t+) when zero phase (=0). • In this way, we can ignore the phase and focuses only on frequency in the bases representation. • Hence, we can decompose a signal into components of different frequencies by using complex exponentials (under some requirements), instead of a more redundant representation of different frequency–phase pairs. Orthogonality of complex exponentials • First, the zero-phase complex exponential ejt can form orthogonal bases. • For simplicity, we take Fourier series as an example, which deals with only periodic signals. – Consider the functional space consisting of all of the periodical signals with period T0, i.e., x(t) belongs to this space if x(t)=x(t+T0). • Let the k-th basis vk(t) in Foruier series be which corresponds to the frequency Orthogonality of complex exponentials • Then, vk(t), which forms orthogonal bases: where * denotes the complex conjugate. That is, Z=a+bj, then z* = a-bj. When z is real, z=z*. • Remark: please be reminded that in complex variables, the inner product of two vectors x and y is denoted as (x*)Ty, not xTy. Proof of the orthogonalility of vk(t) • Preliminary property: • proof 1 at 1 at – In real calculus, e dt e d (at ) e a a where a is a real number. – In complex variables, the above equalities still hold when a is a complex number. at Proof of the orthogonalility of vk(t) • Hence, we have Proof of the orthogonalility of vk(t) • Now, let us consider Proof of the orthogonalility of vk(t) • When k l, by the preliminary property, we have Proof of the orthogonalility of vk(t) • When k = l, Proof of the orthogonalility of vk(t) • Hence, we conclude that • This shows the validity that zero-phase complex exponential can serve potentially as basis functions. • Remark: if you are not familiar with Fourier series, don’t worry and we will introduce in details it later. Phasors Complex number coefficients • Phasors = Complex Amplitude • In addition to orthogonal bases property, there is another requirement to employ zero-phase complex exponentials as bases functions: • The coefficients to be used in the linear combination are extended as complex numbers (instead of real numbers only). • Remember that j w0t jw0t j Ae ( Ae )e Phasors Complex number coefficients • That is, both amplification and phase-shift can be represented as a complex-number coefficient or complex amplitude (which is multiplied to the basis) Ae j w0t j ( Ae )e Both amplitude and phase are multiplied to the basis jw0t Zero-phase basis Summary of the issue of bases • In sum, zero-phase complex exponentials are suitable to serve as bases for signal representations because they satisfy – Orthogonality property – Allow the use of complex-number coefficients (complex amplitude) to represent both amplitude and phase. • In signals and systems, complex exponentials are standard for serving as (frequency-related) basis functions. • However, in other problem domains, such as compression and feature extraction, real-value bases such as cosine functions or wavelet functions are often more suitable. More on Calculation Tricks of Complex Exponentials More on Calculation Tricks of Complex Exponentials Complex Amplitude Sum of Sinusoids Calculation Sum of sinusoids of the equal frequencies is still a sinusoid of the same frequency. How? Amp Phase Illustration Example Adding Sinusoids (Calcluation) Adding Sinusoids Example Adding Sinusoids Adding Sinusoids Another example Spectrum Representation • Frequency-domain representation of a signal. • As we know, a signal can be decomposed as a linear combination of zero-phase complexexponential basis functions. • When doing such a decomposition, the coefficients obtained are referred to as the spectrum of the signal. Spectrum of a single sinusoid • What is the spectrum of a single cosine function? • Note that we employ complex exponential as bases. • Since the spectrum is (,1/2), (, 1/2), containing both positive and negative frequencies: 1/2 Example • Even summing the complex exponentials, we still get a real-value signal Example: Spectrum Representation • The most straightforward way of viewing and understanding a spectrum is to producing new signals from sinusoids by additive linear combination, where a signal is created by adding together a constant and N sinusoids of different frequencies: Spectrum Representation • By the inverse Euler formula • It gives a way to represent x(t) in the alternative form: Spectrum Representation • We define the two-sided spectrum of a signal x(t) composed of sinusoids to be the set of 2N+1 complex amplitudes corresponding to the 2N+1 frequencies: • We term it as the frequency-domain representation of x(t). Example • Apply the inverse Euler formula • The spectrum: Example • They are called the frequency components. DC Component • The constant component (ie., corresponding the zero frequency) is referred to as the DC component. • In the above example, the DC component is 10. • We can separate the frequency components into the amplitude (magnitude) and phase components. Example: Synthetic Sound • A periodic signal can be synthesized as the sum complex exponentials • How is it sounds like: consider a signal containing nonzero terms for only Vowel Example: Single component a2 Vowel: Two components: a2+a4 Vowel: Three components: a2+a4+a5 Vowel: Four components: a2+a4+a5+a16 Five components: a2+a4+a5+a16+a17 Vowel signal: Frequency Domain Multiplication of Sinusoids Beat note and amplitude modulation (AM) • When we multiply two sinusoids have different frequencies, we can create an interesting audio effect called a beat note. • Another use for multiplying sinusoids is modulation for radio broadcasting. AM radio stations use this method. • Multiplication of two sinusoids can be equivalently represented as sum of two sinusoids, as shown below. Example of Multiplication of Sinusoids Product of two sinusoids • By inverse Euler formula, Sum of two sinusoids General Derivation Sum of two sinusoids • Let and Product of two sinusoids In the Spectrum Domain • Spectrum of the multiplication of two sinusoids of frequencies f = (f2-f1)/2 and fc = (f2+f1)/2 • So, f2 = fc + f , f1 = fc - f Example: Beat Note Signal Envelope effect Amplitude Modulation (AM) Signal • The AM signal is is a product of the form where it is assumed that the frequency of the cosine term (fc Hz) is much higher than any frequencies contained in the spectrum of v(t). • Example: let v(t)=5+4cos(40t) and fc =200Hz, its waveform is shown in the following. – unlike the beat note example, we have a DC component here and so the envelope never goes to zero) Example: AM Signal Envelope Frequency Domain Spectrum of the AM Signal Periodic Waveforms • A periodic signal satisfies the condition that x(t+T0)=x(t) for all t. • The time interval T0 is called the period of x(t). • If it is the smallest such repetition interval, it is called the fundamental period. • Harmonically related frequencies: all frequencies are integer multiples of a frequency f0. Periodic Waveforms • The signal would be synthesized as the sum of N+1 cosine waves with harmonically related frequencies: • The frequency fk is called the k-th harmonic of f0, the fundamental frequency. • When we add harmonically related complex exponentials, we get a periodic signal. Nonperiodic Waveforms • What happen when the frequencies have no harmonic relation to one another? • If there are no harmonic assumptions on the individual frequencies fk. • When the combination frequencies are nonharmonic (i.e., does not have a fundamental frequency), the signal could not be periodic. Example: Nonperiodic Waveforms obtained by summing sinusoids • Sum of three cosine waves with nonharmonic frequencies: Fourier Series • Any periodic signal can be synthesized by sum of harmonically related sinusoids. • The sum may need a infinite number of terms. • This is the mathematical theory of Fourier series: Fourier Series • How do we derive the coefficients ak? • Remember that we have shown that the Fourier series bases have the orthogonality property: • Hence, to derive ak, we need simply to project the signal x(t) onto the orthogonal basis vk(t) by inner product with proper normalization. Fourier Series • Obtain ak by inner product of x(t) and vk(t): • In particular, from the above the DC component is obtained by • That is, a0 is simply the average value of the signal over one period. Derivation Details Transform pair of Fourier Series • In sum, we have the following transform pair that can be used for the analysis of periodic signals: transform pair • The left, from x(t) to ak, is called the forward transform, which transform the signal x(t) to the frequency domain, and ak are frequencies or spectrum. • The right, from ak to x(t), is called the inverse transform. Sound Example of Periodic Signals: Sine Wave Sound Example of Periodic Signals: Square Wave Sound Example of Periodic Signals: SAW Wave Sound Example of Beats Wave