EEE 311: Digital Signal Processing-I Course Teacher: Dr. Newaz Md. Syfur Rahim Associated Professor, Dept of EEE, BUET, Dhaka 1000. Syllabus: As mentioned in your course calendar Reference Books: 1. Digital Signal Processing: Principles, Algorithms, and Applications – John G. Proakis 2. Digital Signal Processing: A Practical Approach – Emmanuel C. Ifeachor 3. Schaum’s Outlines of Digital Signal Processing 4. Modern Digital Signal Processing – Roberto Cristi Course Outlines: This course will cover Chapter 1 through 5 of Proakis’s and Chapter 5 through 7 of Ifeachor’s book. Signals Systems and Signal Processing A signal is a function of one or more independent variables that usually represent time and/ or space. A signal contains some kind of information that can be conveyed, displayed, or manipulated. Examples of signals of particular interests are: Speech, which we encounter in telephony, radio, and everyday life. Biomedical signals, such as electrocardiogram Sound and music, such as reproduced by CD player Video and image, which people watch on television Radar signals, which are used to determine the range and bearing of distant targets A system is a practical device that performs an operation on a signal to modify the signal or extract additional information from it. A system may be electrical, mechanical, thermal, hydraulic or an algorithm. By signal processing we mean the type of operations that is performed by the system to the signal. Digital signal processing is concerned with the digital representation of signals and the use of digital processors to analyze, modify, or extract information from signals. The signals used in most DSP are derived from analog signals which have been sampled at regular intervals and converted into a digital form. DSP is now used in many areas where analog methods were previously used and in applications which are difficult or impossible with analog method. Advantages of DSP The main attractions of DSP are due to the following advantages: Digital signal can withstand channel noise and distortion much better than analog signal. Repeaters can be used for long distance digital communication Digital system can be easily modified with software that implements the specific applications. Digital signals can be coded to reduce error rate. Storage of digital signal is easy and inexpensive and does not deteriorate with age. Reproduction of digital messages is extremely reliable without distortion DSP allows sophisticated applications such as speech recognition and image compression to be implemented with low power portable devices The accuracy is only determined by the number of bits used. No drift in performance with temperature or age Linear phase response can be achieved and complex adaptive filtering algorithms can be implemented using DSP techniques. DSP designs can be expensive when large bandwidth signals are involved. The ADCs/ DACs may not have sufficient resolution for wide bandwidth DSP applications. In some DSP systems if an insufficient number of bits are used to represent variables serious degradation in system performance may result. Applications of DSP DSP has revolutionized many areas of science and engineering. They are summarized below: Measurements and analysis: Preconditioning the measured signal by rejecting the disturbing noise and interference. The digital filters can be found in ECG and EEG equipment to record the weak signals in the presence of heavy background noise and interference. DSP techniques are also used for the analysis of radar and sonar echoes. In most GPS receivers today advanced DSP techniques are employed to enhance resolution and reliability. [+ patient monitoring, X-ray storage, enhancement] Telecommunications: DSP is used in telephone systems for DTMF (dual-tone multi-frequency) signaling, echo cancelling of telephone lines, equalizers for high-speed telephone modems, etc. Error-correcting codes are used to protect digital signals from bit errors during data trans-missions. Data compression algorithms are utilized to reduce the number of data bits to represent given information. DSP is used for speech coding in GSM (global system for mobile communication) telephones, in modulators and demodulators etc. [+video conferencing, data communication] Audio and television: Digital signal processing is mandatory in CD players, digital audio tape (DAT) and digital compact cassette (DCC) recorder. Digital methods are also used in digital audio broadcasting (DAB). HDTV systems are utilizing lots of digital image processing techniques. Digital image processing: Digital image processing is used for restoring blurred or distorted images, data compression, identification and analysis of pictures and photos. [+pattern recognition, satellite weather map, facsimile] Automotive: In automotive business DSP is used for control purposes. For example, ignition and injection control system, intelligent suspension system, anti-skid brakes, climate control systems, intelligent cruise controllers, airbag controllers etc. Some speech recognition and speech synthesis are being tasted in automobiles. Experiments have been performed for background noise cancellation in cars using adaptive digital filters. Basic Elements of DSP Systems The block diagram of atypical DSP system is shown in Figure below. The analog input filter is used to band-limit the input signal before digitization to reduce aliasing. The ADC converts the analog input signal into a digital form. The heart of the system is the digital processor (Motorola MC68000, Texas Instruments TMS320C25). The digital processor may implement one of the several DSP algorithms, such as, digital filtering. After processing the signal may be stored in a computer memory for later use or it may be displayed graphically on a display unit. Sampling Sampling is the acquisition of a continuous signal at discrete time intervals. The sampled signal is continuous in amplitude but defined only in discrete points in time. The process is shown in Figure above. The signal obtained in this way is called discrete-time signal and is represented as x(n) . x(n) xa (nT ) ; n where, T is the sampling period. The inverse of it is sampling frequency, Fs . [ Fs 1/ T ] Basic signals 1. Unit sample or unit impulse, (n) 1 n 0 0 n 0 ( n) x(n) 1.5 ( n 2) ( n 1) 1.2 ( n) 0.5 ( n 2) 1.6 (n 3) Note: Any D.T. signal can be expanded into, x(n) x(k ) (n k ) . k 2. Unit step, u (n) 1 n 0 u ( n) 0 n 0 3. Sinusoidal signals A continuous-time sinusoidal signal is defined as, x(t ) A cos(0t ) . A discrete-time sinusoid is obtained by sampling a continuous-time sinusoid with sampling interval, Ts as, x(n) x(nTs ) A cos(0 nTs ) A cos(0 n ) where, 0Ts 2 F0 2 f 0 0 is called the digital frequency. Fs 4. Exponential signal, a n (or e n where, a e and j ) Some peculiarities of discrete-time sinusoids There are two unexpected properties of discrete-time sinusoids which distinguish them with continuous-time sinusoids. 1. A continuous-time sinusoid is always periodic regardless of its frequency, . But a Discrete-time sinusoid is periodic only if is 2 times some rational number. 2. A discrete-time sinusoid does not have unique waveform for each value of . In fact, discrete-time sinusoids with frequencies separated by the multiples of 2 are identical. Thus a sinusoid cos 0 n cos(0 2 k )n cos k n where k is an integer. A discrete-time sinusoid x(n) A cos(0 n ) is periodic with period N 0 , if x(n) x(n N0 ) . Applying this condition we get, 0 N0 2 m or, N 0 2 m 0 . N 0 and m are integers. Figure above shows three sinusoids, cos 4 n, cos 4 n and cos 0.8n . The period of first and the second sinusoids are 8 17 and 17 respectively. The third sinusoid is not periodic. From the second property it can be said that sinusoidal signal has unique waveform over a range of 2 . We may select this range to be to , 0 to 2 , to 3 etc. We shall select this range as to . We call this range as the fundamental range of frequencies. Thus a sinusoid of any frequency is identical to some sinusoid of frequency f in the fundamental range to . Thus, cos(8.7 n ) cos(0.7 n ) and cos(9.6 n ) cos(0.4 n ) . Therefore, the frequency 8.7 is identical to the frequency 0.7 in the fundamental range. Also the frequency 9.6 is identical to the frequency 0.4 in the fundamental range. Further reduction in frequency range Consider, cos(9.6 n ) cos(0.4 n ) cos(0.4 n ) . This result shows that a sinusoid of any frequency can always be expressed as a sinusoid of frequency f , where f lies in the frequency range 0 to . A systematic procedure to reduce the frequency of a sinusoid cos( n ) is to express as, f 2 m ; f and m is an integer. Non-uniqueness of discrete-time sinusoid Figure below shows how two different continuous time sinusoids of different frequencies generate identical discretetime sinusoid. Highest oscillation rate in discrete-time sinusoid The rate of oscillation of a sinusoid increases continuously as increases from 0 to . The rate of oscillation decreases 15 0 or 8 8 7 0 or 4 4 3 0 or 2 2 As increases from to 2 . This is illustrated in Figure above. A frequency ( x) actually appears as the frequency ( x) . Sampling continuous-time sinusoid and aliasing If two sequences x1 (n) A cos(1n 1 ) and x2 (n) A cos(2 n 2 ) have frequencies and phases related by, 2 1 2k , 2 1 or, 2 1 2k , 2 1 with k an integer, then the two sinusoidal sequences have the same samples, i.e. x1 (n) x2 (n) . This is illustrated in Figure below. Here, 1 , 1 2 , 1 and 1 2 represents the same signal in the time domain. If we limit the digital frequency within the interval to then there is one to one correspondence between the signals and their frequency representation. For each frequency in the interval to the corresponding aliases are all outside the interval to itself. Now, the range of unique digital frequencies, T Or, / T / T or, Fs Fs Or, s s 2 2 This implies that the highest frequency of an analog signal must be less than half the sampling frequency to avoid aliasing. Example: Consider the analog signal xa (t ) 3cos 2000 t 5sin 6000 t 10cos12000 t . What is the Nyquist rate for this signal? If the sampling rate is 5000 samples/sec what is the discrete-time signal obtained after sampling? What is the analog signal ya (t ) we can reconstruct from the samples if we use ideal interpolation? ------------------------Nyquist rate is the minimum sampling frequency to avoid aliasing. This is double the maximum frequency of input signal. Here, F1 1000 Hz, F2 3000 Hz and F3 6000 Hz. Thus, Nyquist rate, FN 12000 Hz . 2000 6000 12000 2 6 12 n 5sin n 10 cos n 3cos n 5sin n 10 cos n 5000 5000 5000 5 5 5 2 4 2 2 4 2 n 5sin(2 ) n 10 cos(2 n) 3cos n 5sin n 10 cos n Or, x(n) 3cos 5 5 5 5 5 5 x(n) xa (nTs ) 3cos Or, x(n) 13cos 2 4 n 5sin n. 5 5 1 2 f1 , f 2 5 5 1 2 5000 Hz=1000 Hz , and F2 f 2 Fs 5000 Hz=2000 Hz . 5 5 Thus, ya (t ) 13cos 2000 t 5sin 4000 t . Note that, F1 is less than 2500 Hz. So no aliasing will occur. F2 is greater than 2500 Hz by 500 Hz. So this frequency will For perfect reconstruction, F1 f1 Fs appear as a lower frequency of (2500 - 500)=2000 Hz. Alternately, (3000-5000)= - 2000 Hz. The third frequency will change to (6000 - 5000) = 1000 Hz. Quantization and Encoding Quantization is a process that converts data from infinite or high precision to finite or lower precision. The error introduced in representating the continuous-valued signal by a finite set of discrete value levels is called quantization error and is denoted by e( n) . xˆ (n) Q[ x(n)] e(n) xˆ (n) x(n) The distance between two successive quantization levels is called quantization step size or resolution. The quantizer has (L+1) decision levels x1 , x2 , , xL 1 that divide the amplitude range for x(n) into L intervals. For an input x(n) that falls in the interval I k , the quantizer assigns a value within the interval xˆ (k ) to x(n) . This process is shown in Figure above. xk 1 xk . The number of levels in a quantizer is generally of the form, L 2 B 1 for a B+1 bit binary code word. A 3-bit uniform quantizer in which the quantizer output is rounded to the nearest quantization level is shown in Figure below. With L quantization levels, the range of the quantizer is, R 2B 1 . If the quantizer input is bounded, x(n) X max .