Chapter1 - Page 1
全文
(2) PREFACE This book ; ; ; ; ;. Integrating Matlab with traditional topics on DSP Use Matlab to explore difficult topics and solve problems to gain insight Matlab provides a convenient tool so that many scenarios can be tried with ease Enhance the learning process Assume that the student is familiar with the fundamental of MATLAB. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 2.
(3) PREFACE Organization ; ; ; ; ; ; ; ; ;. of the Book. Chapter 1, Introduction Chapter 2, Discrete-time Signals and Systems Chapter 3, The Discrete-time Fourier Analysis Chapter 4, The Z-Transform Chapter 5, The Discrete Fourier Transform Chapter 6, Digital Filter Structures Chapter 7, FIR Filter Design Chapter 8, IIR Filter Design ...... And more topics. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 3.
(4) CHAPTER One : Introduction ; Introduce the discipline of Signal Processing ; Discuss the advantages of DSP over analog signal processing ; Introduce the MATLAB. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 4.
(5) INTRODUCTION The. field of DSP has grown to be important both theoretically and technologically. Development and use of low-cost software and hardware ; New technologies and applications take advantage of DSP algorithms ; Make DSP an integral part of any E.E. curriculum ;. What. facilities do undergraduate students need in this DSP course ? Advances in PC ; Interactive software, MATLAB ;. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 5.
(6) Why signals should be processed? Signals. are carriers of information. Useful and unwanted ; Extracting, enhancing, storing and transmitting the useful information ;. What. signals are being processed?. Analog Signal Processing vs. ; Digital Signal Processing ;. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 6.
(7) Why signals should be processed? How. are signal processed?. ASP (Analog Signal Processing) ; Processed Using electrical networks containing active and passive circuit elements. ; Analog Signal - Continuously in time and amplitude ~ Ex) Radio & television receiver ;. Example:. Analog Signal : xa(t) Æ Analog signal processor Æ ya(t) : Analog Signal. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 7.
(8) DSP (Digital Signal Processing). Equivalent analog signal processor Analog. Analog PrF. ADC. DSP. DAC. PoF. PrF: antialiasing filtering to prevent aliasing PoF: smoothing filter to smooth out the staircase waveform. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 8.
(9) DSP (Digital Signal Processing) . . . PrF : (Prefilter or antialiasing Filter) ; Conditions the analog signal to prevent aliasing ADC :(Analog-to-Digital Converter) ; Produces a stream of binary number from analog Signal DSP :(Digital Signal Processor) ; Heart of DSP ; General-purpose computer, special-purpose processor digital hardware DAC :(Digital-to-Analog Converter) ; Produce a staircase waveform from a sequence of binary numbers. PoF : (Post filter) ; Smooth out staircase waveform into the desired analog Signal. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 9.
(10) Comparison of DSP over ASP Advantages Developed using software running on a general-purpose computer with high testability and portability. ; DSP operations are base on additions and multiplications (so extremely stable processing, and stability independent of temperature) ; DSP operations can easily be modified in real time, by simple programming changes, or by reloading of register ; DSP has lower cost due to VLSI technology. (memory, gates, microprocessor) ;. Disadvantages ;. . Low speed in very high frequency. DSP Applications ;. Consumer electronics, Communications, Wireless telephones, Medical Image. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 10.
(11) The two categories of DSP Tasks Signal. Analysis: measure signal properties and find what it is in the received signal Spectrum (frequency/phase) analysis ; Speech recognition ; Speaker verification ; Target detection ;. Signal. Filtering: improve the signal quality from corrupted signals by signal-in-signal-out filter Removal of unwanted background noise/interference ; Separation of frequency bands ; Shaping of the signal spectrum ;. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 11.
(12) What is DSP Used For?. …And much more! FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 12.
(13) Speech Processing. Speech. coding/compression Speech synthesis Speech recognition. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 13.
(14) Some Properties of Speech. The blue--- s---p--o---------t i-s--on--the-- k--ey a---g--ai----n------. “oo” in “blue” “e” “ee” “o” “s” “k”in in in in“again” “spot” “key” “key”. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 14.
(15) Some Properties of Speech Vowels. “oo” in “blue”. “o” in “spot”. “ee” in “key”. •Quasi-periodic •Relatively high signal power Consonants. “s” in “spot”. “k” in “key”. •Non-periodic (random) •Relatively low signal power. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 15. “e” in “again”.
(16) Speech Coding MSC(Mobile Switching Center). TRAU(Transcoder/Rate Adapter Unit). 64 kbits/s 13 kbits/s BSC (Base Station Controller). BTS(Base Transceiver). FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 16. 22.8 kbits/s.
(17) Speech Coding – Linear Prediction Try. to predict the current sample value; Transmit the prediction error.. s(n) A(z). – se(n). +. Σ. d(n). …. d(n) +. Σ. sr(n). + se(n). FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 17. A(z).
(18) Digital Audio Standard ; ; ; ; ;. music CD:. Sampling Rate: 44.1 kHz 16-bit samples 2-channel stereo Data transfer rate = 2×16×44,100 = 1.4 Mbits/s 1 hour of music = 1.4×3,600 = 635 MB. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 18.
(19) Audio Coding (Cont’d) Key. standards:. MPEG: Layers I, II, and III (MP3); AAC. ~ used in DAB, DVD ; Dolby AC3, Dolby Digital, Dolby Surround. ;. Typical ;. bit rates for 2-channel stereo:. 64kbits/s to 384 kbits/s.. Subband-. or transform-based, making use of perceptual masking properties.. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 19.
(20) Image/Video Still. Image Coding:. JPEG (Joint Photographic Experts Group): ~ Discrete Cosine Transform (DCT) based ; JPEG2000: Wavelet Transform based ;. Video ;. Coding:. MPEG (Moving Pictures Experts Group): ~ DCT-based,. Interframe and intraframe prediction, ~ Motion estimation. ; Applications: Digital TV, DVD, etc. ~. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 20.
(21) JPEG Example Original. JPEG (4:1). FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 21. JPEG (100:1).
(22) Adaptive Filtering Self-learning:. Filter coefficients adapt in response to training. signal. d(n). +. x(n). W(z). – Σ. e(n). y(n). • Filter update: Least Mean Squares (LMS) algorithm w(n + 1) = w(n) + 2μe(n)x(n) FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 22.
(23) Adaptive Filtering Applications Echo ;. cancellation (telephone lines). Used in modems (making Internet access possible!!). Adaptive. equalization Active noise control Medical signal processing ;. e.g. foetal heart beat monitoring. Image. analysis, e.g:. Face recognition, ; Optical Character Recognition (OCR); ;. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 23.
(24) Adaptive Filtering Applications Restoration. of old image, video, and audio signals; Analysis of RADAR data; Analysis of SONAR data; Data transmission (modems, radio, echo cancellation, channel equalization, etc.); Storage and archiving; Control of electric motors.. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 24.
(25) DSP Devices & Architectures Selecting. a DSP – several choices:. Fixed-point; ; Floating point; ; Application-specific devices (e.g. FFT processors, speech recognizers,etc.). ;. Main. DSP Manufacturers:. Texas Instruments (http://www.ti.com) ; Motorola (http://www.motorola.com) ; Analog Devices (http://www.analog.com) ;. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 25.
(26) FEW WORDS ABOUT MATLAB. . FEW WORDS ABOUT MATLAB ;. . MATLAB is an interactive, matrix –based system for scientific and engineering numeric computation and visualization. MATLAB Tutorial : Referenced from Tolga Kurt [1]. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 26.
(27) Getting Started Matlab. - Matrix laboratory A high-level technical computing language and interactive environment Useful for : ; analyzing data ; developing algorithms and applications. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 27.
(28) Defining vectors and matrices –(1/2) . Defining a matrix ; Rows are separated by semicolons. ; Semicolons will prevent the results display on the command window. ; To display type the name of the variable.. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 28.
(29) Defining vectors and matrices –(2/2) . Definition with increments:. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 29.
(30) Basic Operations . Element by element operations: ; ; ; ; ; ; ; ; ; ;. A+B Element by element addition A-B Element by element subtraction A*B Matrix multiplication A.*B Element by element multiplication A/B A*inv(B) A./B Element by element division A^B Matrix power A.' Transpose A' Complex conjugate transpose A^-1 Matrix inverse - inv(A). FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 30.
(31) Graphs . Using built in function. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 31.
(32) M-file example %%Generate two random shifted BPSK clear close all clc list=[.5 .6 .7 .8 .9 1] count=0; for k=list; count=count+1 R1=sqrt(k); R2=sqrt(1-k); mx2=0; itmax=100000; av=0; FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 32. for t=1:itmax A=R1*(randint(64,1,2)*2-1); B=R2*(randint(64,1,2)*2-1); Tran=A+B*j;. av=av+mean(abs(Tran).^2)/itmax; end son(count)=10*log10(mx2/av); end plot(list,son).
(33) M-file example % MATLAB script that generates the probability of error versus the signal to noise ratio. initial_snr=0; final_snr=12; snr_step=0.75; tolerance=eps; % Tolerance used for the integration plus_inf=20; % This is practically infinity snr_in_dB=initial_snr:snr_step:final_snr; for i=1:length(snr_in_dB), snr=10^(snr_in_dB(i)/10); Pe_2(i)=1-quad8('bdt_int2',0,plus_inf,tolerance,[],snr,2); Pe_4(i)=1-quad8('bdt_int2',0,plus_inf,tolerance,[],snr,4); Pe_8(i)=1-quad8('bdt_int2',0,plus_inf,tolerance,[],snr,8); Pe_16(i)=1-quad8('bdt_int2',0,plus_inf,tolerance,[],snr,16); Pe_32(i)=1-quad8('bdt_int2',0,plus_inf,tolerance,[],snr,32); end; FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 33.
(34) M-file example % Plotting commands follow t=snr_in_dB; semilogy(t,Pe_2,'-',t,Pe_4,'--',t,Pe_8,'-.',t,Pe_16,':',t,Pe_32,'-') legend('M=2','M=4','M=8','M=16','M=32',0); axis([initial_snr,final_snr,1e-16,1e0]) xlabel('Input SNR per Bit','fontsize',16,'fontname','Arial') ylabel('Symbol Error Rate (SER)','fontsize',16,'fontname','Arial') set(findobj('Type','line'),'LineWidth',2) set(findobj('fontname','Helvetica'),'fontname','Times new Roman','fontsize',16) title('Symbol error probability for biorthogonal signals') hold off. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 34.
(35) DSP example. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 35.
(36) DSP example. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 36.
(37) DSP example. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 37.
(38) DSP example. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 38.
(39) DSP example. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 39.
(40) DSP example. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 40.
(41) DSP example. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 41.
(42) DSP example. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 42.
(43) DSP example. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 43.
(44) DSP example. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 44.
(45) More about Matlab MATLAB. Tutorial by. 張智星 ; [email protected] ; http://neural.cs.nthu.edu.tw/jang/ ;. Topics ; ; ; ; ; ;. 01-MATLAB小傳與外觀 02-初探MATLAB 03-二維平面繪圖 09-矩陣的處理與運算 14-MATLAB 的運算元 15-M檔案. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 45.
(46) Useful References . http://www.genie.uottawa.ca/~ieee/pdffiles/matlab.ppt http://neural.cs.nthu.edu.tw/jang/ http://www.math.ohiou.edu/courses/matlab/ Matlab Help http://webclass.ncu.edu.tw/~junwu/index.html http://caig.cs.nctu.edu.tw/course/NM/slides/MatlabTutorial.pdf http://users.ece.gatech.edu/~bonnie/book/TUTORIAL/tutorial.html Contemporary communication systems using MATLAB / J. G. Proakis, M. Salehi. MATLAB programming for engineers / Stephen J. Chapman. Simulation and Software Radio for Mobile Communications, Chapter 2, H. Harada and R. Prasad …. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 46.
(47) § HomeWork http://www.math.ohiou.edu/courses/matlab/ ;. Math410, 1,2,3,4,5. Due. date: 本章結束後當週星期五。. FJU-EE – YUJL – Introduction DSP– Chapter1 - Page 47.
(48) Chapter 2. Discrete-Time Signals and Systems . Important types of signals and their operations Linear and shift-invariant system The convolution and difference equation representations Representations and implementation of signal and systems using MATLAB. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 1.
(49) §2.1 Discrete-Time Signals . . Category of signals : Analog and discrete signals Analog signal xa(t) ; t represents any physical quantity, time in sec. Discrete-Time Signals x(n) : ; n is integer valued, represents discrete instances in time. ; A discrete-time signal, which is a number sequence, will be denoted by one of the following notations:. ;. x ( n ) = {x ( n )} = {" , x ( −1), x (0), x (1),"} ↑. where the up-arrow indicates the sample at n=0.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 2.
(50) §2.1 Discrete-Time Signals . In Matlab, a finite-duration sequence representation requires two vectors, and each for x and n. ; Example: x ( n ) = {2,1, −1, 0,1, 4,3,7} ↑. ;. Then in Matlab : n = [−3,−2,−1,0,1,2,3,4];. x = [2,1,−1,0,1,4,3,7]; ;. Question: whether or not an arbitrary infinite-duration sequence can be represented in MATLAB?. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 3.
(51) Types of Elementary Sequences . Unit sample sequence δ(n) ⎧1, n = 0 δ (n) = ⎨ = " ,0,0,1,0,0," ↑ ⎩0, n ≠ 0. {. }. ⎧1, n = n0 δ ( n − n0 ) = ⎨ ⎩0, n ≠ n0 . Representation in MATLAB ; n=[n1:n2]; x = zeros(1,n2-n1+1); x(n0-n1+1)=1; ; n=-2:30; x=[zeros(1,2),1,zeros(1,30)];stem(n,x); ; n=[n1:n2]; x = [(n-n0)==0]; stem(n,x,’ro’);. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 4.
(52) Types of Elementary Sequences . Unit sample sequence. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 5.
(53) Unit Step Sequence u(n) . Unit step sequence ⎫ ⎧1, n ≥ 0 ⎧ = ⎨" ,0,0, 1,1,1,"⎬ u(n ) = ⎨ ⎩0, n < 0 ⎩ ↑ ⎭ ⎧1, n ≥ n0 u( n − n0 ) = ⎨ ⎩0, n < n0. . Representation in MATLAB ; n=0:30; x=[ones(1,31)]; stem(n,x); ; n=[n1:n2]; x=[(n-n0)>=0];. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 6.
(54) Unit Step Sequence u(n) . Unit step sequence. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 7.
(55) Real-valued exponential sequence . Real-valued exponential sequence. x(n) = a , ∀n; a ∈ R n. n x ( n ) = ( 0 . 9 ) , 0 ≤ n ≤ 10 For Example:. n=[0:10]; x=(0.9).^n; stem(n,x,’ro’) 1 0.8 0.6 0.4 0.2 0. 0. 1. 2. 3. 4. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 8. 5. 6. 7. 8. 9. 10.
(56) Real-valued exponential sequence 1. 2. 3. 4. 5.. 1. 2. 3. 4. 5.. a=3/4; n=0:10; x=a.^n; subplot(2,1,1) stem(n,x);. x ( n ) = a n , ∀n ; a ∈ R. a=4/3; n=0:10; x=a.^n; subplot(2,1,2) stem(n,x);. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 9.
(57) Complex-valued exponential sequence . Complex-valued exponential sequence. x ( n) = e. (σ + jω0 ) n. , ∀n. σ: Attenuation: 衰减因子 Ω0: frequency in radians: For Example: n=[0:10]; x=exp((2+3j)*n);. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 10.
(58) Sinusoidal Sequence . Complex-valued exponential sequence. x ( n ) = A cos(ω0n + θ ), ∀n 1. 2. 3. 4. 5. 6. 7.. a=2;f0=4;phi=pi/6; w0=2*pi*f0; t=0:.001:1; x=a*sin(w0*t+phi); plot(t,x); ylable('x(t)');xlable('Time (s)'); title('sinusoidal signal');. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 11.
(59) Random Sequence . In Matlab two types of (pseudo-) random sequences are available. ; The rand(1,N) generates a length N random sequence whose elements are uniformly distributed between[0,1]. ; The randn(1,N) generates a length N Gaussian random sequence with mean 0 and variance 1.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 12.
(60) Periodic sequence . A sequence x(n) is periodic if x(n)=x(n+N) The smallest integer N is called the fundamental period For example ; A: xtilde=[x,x,x,x,x,x,x,x,x,x,x,x,x] ; B: xtilde=x’*ones(1,P); xtilde=xtilde(:); xtilde=xtilde’;. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 13.
(61) OPERATIONS ON SEQUENCES . Signal addition Signal multiplication Scaling Shifting Folding Sample summation Sample products Signal energy Signal power. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 14.
(62) 1. Signal addition . Signal addition is a sample-by-sample addition given by ; {x1(n)}+{x2(n)}={x1(n)+x2(n)} ; It is implemented in Matlab by the arithmetic operator ”+”. However, the lengths of x1(n) and x2(n) must be the same. The following function called the sigadd function, demonstrates these operations. 1. 2. 3. 4. 5. 6.. function [y,n]=sigadd(x1,n1,x2,n2) n=min(min(n1),min(n2)): max(max(n1),max(n2)); y1=zeros(1,length(n)); y2=y1; y1(find((n>=min(n1)) & (n<=max(n1))==1))=x1; y2(find((n>=min(n2)) & (n<=max(n2))==1))=x2; y=y1 + y2;. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 15.
(63) 2. Signal multiplication . Signal multiplication is a sample-by-sample multiplication given by ; {x1(n)}.{x2(n)}={x1(n)x2(n)} ; It is implemented in Matlab by the arithmetic operator ”.*”. Once again the similar restrictions apply for the .* operator . Therefore we have developed the sigmult function, which is similar to the sigadd function. 1. 2. 3. 4. 5. 6.. function [y,n]=sigmult(x1,n1,x2,n2) n=min(min(n1),min(n2)) : max(max(n1),max(n2)); y1=zeros(1,length(n)); y2=y1; y1(find((n>=min(n1)) & (n<=max(n1))==1))=x1; y2(find((n>=min(n2)) & (n<=max(n2))==1))=x2; y=y1 .* y2;. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 16.
(64) 3. Scaling . In this operation each sample is multiplied by a scalar α. α{x(n)}={αx(n)} An operator “*” is used to implement the scaling operation in Matlab.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 17.
(65) 4. Shifting . . In this operation each sample of x(n) is shifted by an amount k to obtain x(n-k). ; y(n)={x(n-k)} ; Or if we let m=n-k, y(m+k)={x(m)} This is shown in the function sigshift. ; function [y,n] = sigshift(x,m,n0) ; % implements y(n) = x(n-n0) ; n = m+n0; y = x;. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 18.
(66) 5. Folding . . In this operation each sample of x(n) is flipped around n=0 to obtain a folded sequence x(-n). ; y(n)={x(-n)} This is shown in the function sigfold. ; function [y,n] = sigfold(x,n) ; % implements y(n) = x(-n) ; y = fliplr(x); n = -fliplr(n);%fliplr. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 19.
(67) 6. Sample summation . It adds all sample values of x(n) between n1 and n2 It is implemented by the sum(x(n1:n2)) function. n = n2. ∑ x(n) = x(n ) + ... + x(n ). n = n1. 1. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 20. 2.
(68) 7. Sample products . It multiplies all sample values of x(n) between n1 and n2. It is implemented by the prod(x(n1:n2)) function. n2. ∏ x(n) = x(n ) × ... × x(n ) 1. n1. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 21. 2.
(69) 8. Signal energy . The energy of a sequence x(n) is given by. εx = . ∞. ∞. ∑ x(n ) x (n ) = ∑ *. n =−∞. x(n). 2. n =−∞. The energy of a finite-duration sequence x(n) can be computed in MATLAB using ; Ex=sum(x.*conj(x));% one approach ; Ex=sum(abs(x).^2); % another approach. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 22.
(70) 9.Signal power . The average power of a periodic sequence with fundamental period N is given by 1 Px = N. N −1. ∑ x(n). 2. n =0. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 23.
(71) EXAMPLE 2.1 . EXAMPLE 2.1 Generate and plot each of the following sequences over the indicated interval. ; % a) x(n) = 2*delta(n+2) - delta(n-4), -5<=n<=5 1. 2. 3.. ;. n = [-5:5]; x = 2*impseq(-2,-5,5)-impseq(4,-5,5); subplot(2,2,1); stem(n,x); title('Sequence in Example 2.1a') xlabel('n'); ylabel('x(n)'); axis([-5,5,-2,3]). % b) x(n) = n[u(n)-u(n-10)]+10*exp(-0.3(n-10))(u(n-10)-u(n-20)); 0<=n<=20 1. 2. 3. 4. 5.. n = [0:20]; x1 = n.*(stepseq(0,0,20)-stepseq(10,0,20)); x2 = 10*exp(-0.3*(n-10)).*(stepseq(10,0,20)-stepseq(20,0,20)); x = x1+x2; subplot(2,2,2);stem(n,x); title('Sequence in Example 2.1b') xlabel('n');ylabel('x(n)');axis([0,20,-1,11]). FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 24.
(72) EXAMPLE 2.1 ;. % c) x(n) = cos(0.04*pi*n) + 0.2*w(n); 0<=n<=50, w(n)ŒN(0,1) 1. 2. 3. 4.. ;. n = [0:50]; x = cos(0.04*pi*n)+0.2*randn(size(n)); subplot(2,2,3);stem(n,x);title('Sequence in Example 2.1c') xlabel('n');ylabel('x(n)');axis([0,50,-1.4,1.4]). d) x(n) = {...,5,4,3,2,1,5,4,3,2,1,...}; -10<=n<=9 1. 2. 3. 4. 5. 6.. n=[-10:9]; x=[5,4,3,2,1]; xtilde=x' * ones(1,4); xtilde=(xtilde(:))'; subplot(2,2,4);stem(n,xtilde);title('Sequence in Example 2.1d') xlabel('n');ylabel('xtilde(n)');axis([-10,9,-1,6]). FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 25.
(73) EXAMPLE 2.1 Sequence in Example 2.1a. Sequence in Example 2.1b. 3 10 2. 8. x(n). x(n). 1 0. 6 4 2. −1. 0 −2 −5. 0 n. 5. 0. Sequence in Example 2.1c. 5. 10 n. 15. Sequence in Example 2.1d 6. 1. 5 4. xtilde(n). x(n). 0.5 0 −0.5. 3 2 1. −1. 0 0. 10. 20. 30. 40. n. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 26. 50. −1 −10. −5. 0 n. 5. 20.
(74) EXAMPLE 2.2 . Let x(n)={1,2,3,4,5,6,7,6,5,4,3,2,1}. Determine and plot the following sequences. ; figure(1); clf ; n = -2:10; x = [1:7,6:-1:1]; ; % a) x1(n) = 2*x(n-5) - 3*x(n+4) 1. 2. 3. 4. 5.. [x11,n11] = sigshift(x,n,5); [x12,n12] = sigshift(x,n,-4); [x1,n1] = sigadd(2*x11,n11,-3*x12,n12); subplot(2,1,1); stem(n1,x1); title('Sequence in Example 2.2a') xlabel('n'); ylabel('x1(n)'); axis([min(n1)-1,max(n1)+1,min(x1)1,max(x1)+1]) set(gca,'XTickMode','manual','XTick',[min(n1),0,max(n1)]). FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 27.
(75) EXAMPLE 2.2 ;. % b) x2(n) = x(3-n) + x(n)*x(n-2) 1. 2. 3. 4. 5. 6.. [x21,n21] = sigfold(x,n); [x21,n21] = sigshift(x21,n21,3); [x22,n22] = sigshift(x,n,2); [x22,n22] = sigmult(x,n,x22,n22); [x2,n2] = sigadd(x21,n21,x22,n22); subplot(2,1,2); stem(n2,x2); title('Sequence in Example 2.2b') xlabel('n'); ylabel('x2(n)'); axis([min(n2)-1,max(n2)+1,0,40]) set(gca,'XTickMode','manual','XTick',[min(n2),0,max(n2)]). FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 28.
(76) EXAMPLE 2.2 Sequence in Example 2.2a 15 10 5. x1(n). 0 −5 −10 −15 −20 −6. 0. 15 n Sequence in Example 2.2b. 40. x2(n). 30. 20. 10. 0. −7. 0. 12 n. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 29.
(77) EXAMPLE 2.3 . . Generate the complex-valued signal x(n) = exp((-0.1+j0.3)n), for -10≦n ≦ 10 And plot its magnitude, phase , the real part, and the imaginary part in four separate subplots. Solution : figure(1); clf 1. 2. 3. 4. 5. 6.. n = [-10:1:10]; alpha = -0.1+0.3j; x = exp(alpha*n); subplot(2,2,1); stem(n,real(x));title('real part');xlabel('n') subplot(2,2,2); stem(n,imag(x));title('imaginary part');xlabel('n') subplot(2,2,3); stem(n,abs(x));title('magnitude part');xlabel('n') subplot(2,2,4); stem(n,(180/pi)*angle(x));title('phase part');xlabel('n'). FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 30.
(78) EXAMPLE 2.3 real part. imaginary part. 2. 1. 1. 0.5 0. 0. −0.5 −1. −1. −2 −3 −10. −1.5 −5. 0 n. 5. 10. −2 −10. −5. magnitude part. 0 n. 5. 10. 5. 10. phase part. 3. 200. 2.5 100 2 1.5. 0. 1 −100 0.5 0 −10. −5. 0 n. 5. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 31. 10. −200 −10. −5. 0 n.
(79) Some useful results . Unit sample synthesis ;. Any arbitrary sequence x(n) can be synthesized as a weighted sum of delayed and scaled unit sample sequences, such as x( n) =. ∞. ∑ x(k )δ (n − k ). k = −∞. . Even and odd synthesis. A real-valued sequence x0(n) is called even (symmetric) if xe(n)=xe(-n) ; A real-valued sequence x0(n) is called odd (antisymmetric) if x0(n)=x0(-n) ;. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 32.
(80) Some useful results . . Then the arbitrary real-valued sequence x(n) can be decomposed into its even and odd components. x(n)=xe(n)+x0(n) where the even and odd parts are given by xe(n)=1/2[x(n)+x(-n)] and x0 (n)=1/2[x(n)-x(-n)] We will use this decomposition in studying properties of the Fourier transform. Using MATLAB operations discussed so far, we can obtain the following evenodd function.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 33.
(81) Evenodd function . function [xe, xo, m] = evenodd(x,n) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12.. % Real signal decomposition into even and odd parts % [xe, xo, m] = evenodd(x,n) if any(imag(x) ~= 0) error('x is not a real sequence') end m = -fliplr(n); m1 = min([m,n]); m2 = max([m,n]); m = m1:m2; nm = n(1)-m(1); n1 = 1:length(n); x1 = zeros(1,length(m)); x1(n1+nm) = x; x = x1; xe = 0.5*(x + fliplr(x)); xo = 0.5*(x - fliplr(x));. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 34.
(82) EXAMPLE 2.4 . Let x(n)=u(n)-u(n-10). Decompose x(n) into even and odd components. Solution : 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.. n = [0:10]; x = stepseq(0,0,10)-stepseq(10,0,10); [xe,xo,m] = evenodd(x,n); subplot(1,1,1) subplot(2,2,1); stem(n,x); title('Rectangular pulse') xlabel('n'); ylabel('x(n)'); axis([-10,10,0,1.2]) subplot(2,2,2); stem(m,xe); title('Even Part') xlabel('n'); ylabel('xe(n)'); axis([-10,10,0,1.2]) subplot(2,2,4); stem(m,xo); title('Odd Part') xlabel('n'); ylabel('xe(n)'); axis([-10,10,-0.6,0.6]). FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 35.
(83) EXAMPLE 2.4 Even Part 1.2. 1. 1. 0.8. 0.8. xe(n). x(n). Rectangular pulse 1.2. 0.6. 0.6. 0.4. 0.4. 0.2. 0.2. 0 −10. −5. 0 n. 5. 0 −10. 10. −5. 0 n. 5. 10. 5. 10. Odd Part 0.6 0.4. xe(n). 0.2 0 −0.2 −0.4 −10. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 36. −5. 0 n.
(84) The geometric series . A one-side exponential sequence of the form {an, n>=0}, where a is an arbitrary constant, is called a geometric series. The series converges for |a|<1, while the sum of its components converges to ∞. 1 ∑ a → 1 − a , for | a |< 1 n =0 . n. We will also need an expression for the sum of any finite number of terms of the series given by N 1 − a ∑ a n = 1 − a , ∀a n =0. N −1. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 37.
(85) Correlations of sequences . It is a measure of the degree to which two sequences are similar. Given two real-valued sequences x(n) and y(n) of finite energy, ; the cross correlation of x(n) and y(n) is a sequence rxy(l) defined as ∞ The index l is called rx , y (l ) = ∑ x ( n) y ( n − l ) the shift or lag n = −∞. ;. parameter.. When y(n)=x(n) is called autocorrelation and is defined by rx , x (l ) =. ∞. ∑ x ( n) x ( n − l ). n = −∞. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 38.
(86) §2.2 DISCRETE SYSTEMS . . Mathematically, discrete system is an operation T[.] ; y(n) = T [ x(n)] ; x(n): excitation, input signal ; y(n): response, output signal Discrete systems are broadly classified into linear and nonlinear systems. We will deal mostly with linear systems. A discrete system T[.] is a linear operator L[.] if and only if L[.] satisfies the principle of superposition, namely, L[a1 x1 (n) + a2 x2 (n)] = a1 L[ x1 (n)] + a2 L[ x2 (n)] ∀a1 , a2 , x1 (n), x2 (n). FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 39.
(87) Linear System . The output y(n) of a linear system to an arbitrary input x(n) is given by ⎡ +∞ ⎤ +∞ y ( n ) = L[ x (n )] = L ⎢ ∑ x ( k )δ ( n − k ) ⎥ = ∑ x ( k ) L[δ ( n − k )] ⎣ n =−∞ ⎦ n =−∞. . The response L[δ (n − k )] can be interpreted as the response of a linear system at time n due to a unit sample at time k. It is called an impulse response and is denoted by h(n,k). The output then is given by the superposition summation y (n ) =. ∞. ∑ x ( k )h ( n, k ) ,. n =−∞. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 40. h ( n, k ) = L[δ ( n − k )].
(88) Linear time-invariant (LTI) sysem . Linear time-invariant (LTI) system ; A linear system in which an input-output pair, x(n) and y(n), is invariant to a shift k in time. ; y(n) = L[x(n)] ÆÆ y(n-k) = L[x(n-k)] ; For an LTI system the L[.] and the shifting operators are reversible as shown below. x(n) x(n) ;. L[.] Shift by k. y(n). Shift by k. x(n-k). L[.]. h(n) ≣h(n,0)=L[δ(n)]ÆÆ h(n-k) = L[δ(n-k)]. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 41. y(n-k) y(n-k).
(89) Linear time-invariant (LTI) sysem . The output of an LTI system to input x(n) is given by y (n) =. . . ∞. ∞. n =−∞. n =−∞. ∑ x ( k )h ( n, k ) = ∑ x ( k )h ( n − k ) ≡ x ( n ) ∗ h ( n ). The impulse response of an LTI system is given by h(n). The mathematical operation shown above is called a linear convolution sum and is denoted by y(n)=x(n)*h(n). Hence an LTI system is completely characterized in the time domain by the impulse response h(n) as shown below. x(n). h(n). FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 42. y(n)=x(n)*h(n).
(90) Stability . . A system is said to be bounded-input bounded-output (BIBO) stable if every bounded input produces a bounded output. An LTI system is BIBO stable if and only if its impulse response is absolutely summable. BIBO Stability ←→ x(n ) < ∞ ⇒ y (n ) < ∞, ∀x, y ∞. ←→ ∑ h(n) < ∞ −∞. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 43.
(91) Causality . . This important concept is necessary to make sure that systems can be built. ; A system is said to be causal if the output at index n0 depends only on the input up to and including the index n0 ; The output does not depend on the future values of the input. ; An LTI system is causal if and only if the impulse response satisfies h(n)=0 for n<0. n<0 In signal processing , unless otherwise stated, we will always assume that the system is causal.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 44.
(92) §2.3 CONVOLUTION . Convolution for an LTI system can be evaluated in many different ways ; If the sequences are mathematical functions, then we can analytically evaluate x(n)*h(n) for all n to obtain a functional form ∞ of y(n) y (n ) x(n ) * h(n ) =. ∑ x ( k )h ( n − k ). k =−∞. Graphical interpretation, folded-and-shifted version ; Matlab implementation ;. function [y,ny]=conv_m(x,nx,h,nh) 2. nyb = nx(1)+nh(1); nye = nx(length(x))+nh(length(h)); 3. ny = [nyb:nye]; 4. n = conv(x,h) 1.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 45.
(93) EXAMPLE 2.5 . Let the rectangular pulse x(n)=u(n)-u(n-10) of example 2.4 be an input to an LTI system with impulse response. h(n) = (0.9) u (n) n. Determine the output y(n) . Solution : The input x(n) and impulse response h(n) are shown in figure 2.5. From (2.11). y ( n ) = ∑ k =−∞ x ( k )h ( n − k ) ∞. = ∑ k =0 (1)(0.9) 9. . ( n −k ). u( n − k ) = (0.9). (2.15) n. −k (0.9) u(n − k ) ∑ k =0 9. It is almost a geometric series sum except that the term u(n-k) takes different values depending on n and k. There are three different conditions under which u(n-k) can be evaluated.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 46.
(94) EXAMPLE 2.5 . . Case 1Æ n<0: Then u(n-k)=0. Hence from (2.15) ; y(n)=0 ; In this case the nonzero values of x(n) and h(n) do not overlap. Case 2: 0<=n<9 % partially overlaps. Then u(n-k)=1, 0≦k≦n. Hence from (2.15) n. y ( n ) = (0.9) n ∑ (0.9) − k = 10[1 − (0.9) n +1 ],. 0≤n<9. k =0. . Case 3: n>=9 % completely overlaps. Then u(n-k)=1, 0≦k≦9. Hence from (2.15) y ( n ) = (0.9). 9. n. −k n −9 10 (0.9) = 10(0.9) [1 − (0.9) ], ∑ k =0. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 47. n≥9.
(95) EXAMPLE 2.5 Input Sequence. x(n). 2 1 0 −5. 0. 5. 10. 15. 20. 25. 30. 35. 40. 45. 50. 30. 35. 40. 45. 50. 30. 35. 40. 45. 50. n Impulse Response h(n). 2 1 0 −5. 0. 5. 10. 15. 20. 25. y(n). n Output Sequence 5 0 −5. 0. 5. 10. 15. 20. 25 n. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 48.
(96) EXAMPLE 2.6 . . The above example can also be done by using graphical convolution. In this method h(n-k) is interpreted as a folded-and-shift version of h(k). The output y(n) is obtained as a sample sum under the overlap of x(k) and h(n-k). Given a sequence x(n), what are the following sequences like? shift ; x(n-3) ; x(n+2) ; x(-n) folded ; x(-n-3) ; x(-n+2). FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 49.
(97) EXAMPLE 2.6 Given the two sequences x(n)=[3,11,7,0,-1,4,2 ], -3≦n≦3 and h(n)=[2,3,0,-5,2,1], -1≦n≦4, determine the convolution y(n)=x(n)*h(n). ; Solution : we plot x(k) and h(k), the original sequences first. Then sequences h(-k), h(-1-k), … etc are plotted. ;. y ( n ) = ∑ k =−∞ x ( k )h ( n − k ) ∞. y ( −1) = ∑ k =−∞ x ( k )h( −1 − k ) = 3 × ( −5) + 11 × 0 + 7 × 3 + 0 × 2 = 6 ∞. y (2) = ∑ k =−∞ x ( k )h(2 − k ) = 41 ∞. ;. Note that the beginning point (first nonzero sample) of y(n) is given by n=-3+(-1)=-4, while the end point (the last nonzero sample) is given by n=3+4=7. the complete output is given y (n) = {6,31,47,6,−51,−5,41,18,−22,−3,8,2}. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 50.
(98) EXAMPLE 2.6 x(k) and h(k) 10. solid: x. x(k) and h(−k) dashed: h. 10. 5. 5. 0. 0. −5. −5. −5. 0 k. 5. −5. x(k) and h(−1−k) 10. solid: x. dashed: h. 10. n=0. 0 k. 5. solid: x. dashed: h. 5. 0. n=−1. −5 −5. dashed: h. x(k) and h(2−k). 5. 0. solid: x. n=2. −5 0 k. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 51. 5. −5. 0 k. 5.
(99) EXAMPLE 2.6 Given the two sequences x(n)=[3,11,7,0,-1,4,2 ], -3≦n≦3 and h(n)=[2,3,0,-5,2,1], -1≦n≦4, determine the convolution y(n)=x(n)*h(n). 3 Solution : y (n ) = ∑ k =−3 x (k )h(n − k ) ;. . h(n ) x(n ). x ( −3) = 3 x ( −2) = 11 x ( −1) = 7. x (0) = 0 x (1) = −1 x (2) = 4 x (3) = 2. h ( −1) = 2. 6. 22. 14. 0. −2. 8. 4. h (0) = 3. 9. 33. 21. 0. −3. 12. 6. h (1) = 0. 0. 0. 0. 0. 0. 0. 0. h (2) = −5 h (3) = 2. −15 6. −55 22. −35 14. 0 0. 5 −2. −20 8. −10 4. h (4) = 1. 2. 11. 7. 0. −1. 4. 2. y (n) = {6,31,47,6,−51,−5,41,18,−22,−3,8,2} FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 52.
(100) MATLAB IMPLEMENTATION . . . Matlab provides a built-in function called conv.m that computes the convolution between two finite duration sequence. The conv function assumes that the two sequences begin at n=0 and is invoked by ; y=conv(x,h); For example, to do the convolution in Ex. 2.5, we could use ; x=[3,11,7,0,-1,4,2]; ; h=[2,3,0,-5,2,1]; ; y=conv(x,h) We obtain the correct convolution results but lose the time index.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 53.
(101) MATLAB IMPLEMENTATION . . Let {x(n); nxb≦n≦ nxe} and {h(n); nhb≦n≦ nhe} be two finite-duration sequences. Referring to Example 2.6, we observe that the beginning and end points of y(n) are nyb=nxb+nhb and nye=nxe+nhe A simple extension of the conv function, called conv_m, which performs the convolution of arbitrary support sequences can now be designed. 1. function [y,ny] = conv_m(x,nx,h,nh) 2. nyb = nx(1)+nh(1); nye = nx(length(x)) + nh(length(h)); 3. ny = [nyb:nye]; 4. y = conv(x,h);. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 54.
(102) EXAMPLE 2.7 . . Perform the convolution in Example 2.6 using the conv_m function. ; x = [3, 11, 7, 0, -1, 4, 2]; nx = [-3: 3]; ; h = [2, 3, 0, -5, 2, 1]; nh = [-1: 4]; ; [y,ny] = conv_m(x,nx,h,nh) ; Hence y(n)={6,31,47,6,-51,-5,41,18,-22,-3,8,2} An alternate method in Matlab can be used to perform the convolution. This method uses a matrix-vector multiplication approach, which is explored in Problem 2.17.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 55.
(103) SEQUENCE CORRELATIONS REVISITED . The correlation can be computed using the conv function if sequences are of finite duration. ryx ( n ) = rxx ( n ) =. . +∞. +∞. k =−∞. k =−∞. +∞. +∞. k =−∞. k =−∞. ∑ y (k ) x(k − n) = ∑ y (k ) x( −(n − k )) = y (n) * x(−n). ∑ x(k ) x(k − n) = ∑ x(k ) x( −(n − k )) = x(n) * x(−n). Example 2.8: we will demonstrate one application of the crosscorrelation sequence. Let x(n)=[3,11,7,0,-1,4,2] be a prototype sequence, and let y(n) be its noise-corruptedand-shifted version y ( n) = x ( n − 2) + ω ( n) where ω(n) is Gaussian sequence with mean 0 and variance 1. Compute the crosscorrelation between y(n) and x(n).. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 56.
(104) Example 2.8 . Solution ; Form the construction of y(n) it follows that y(n) is “similar” to x(n-2) and hence their crosscorrelation would show the strongest similarity at l=2. To test this out using Matlab, let us compute the crosscorrelation using two different noise sequences. ~ ~ ~ ~ ~ ~ ~ ~ ~ ~. x = [3, 11, 7, 0, -1, 4, 2]; nx=[-3:3]; % given signal x(n) [y,ny] = sigshift(x,nx,2); % obtain x(n-2) w = randn(1,length(y)); nw = ny; % generate w(n) [y,ny] = sigadd(y,ny,w,nw); % obtain y(n) = x(n-2) + w(n) [x,nx] = sigfold(x,nx); % obtain x(-n) [rxy,nrxy] = conv_m(y,ny,x,nx); % cross-corrlation subplot(1,1,1);subplot(2,1,1);stem(nrxy,rxy) axis([-4,8,-50,250]);xlabel('lag variable l') ylabel('rxy');title('Crosscorrelation: noise sequence 1') gtext('Maximum'). FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 57.
(105) Example 2.8 Crosscorrelation: noise sequence 1 250 Maximum. 200. rxy. 150 100 50 0 −50 −4. −2. 0. 2 lag variable l. 4. 6. 8. 6. 8. Crosscorrelation: noise sequence 2 250 Maximum. 200. rxy. 150 100 50 0 −50 −4. −2. 0. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 58. 2 lag variable l. 4.
(106) Example 2.8 . . From Figure 2.8 we observe that the crosscorrelation indeed peaks at l=2, which implies that y(n) is similar to x(n) shifted by 2. This approach can be used in applications like radar signal processing in identifying and localizing targets. It should be noted that the signal-processing toolbox in Matlab also provides a function called xcorr for sequence correlation computations. In its simplest form, we use ; >>xcorr(x,y) to compute the crosscorrelation between vectors x and y, while ; >>xcorr(x) to compute the autocorrelation of vector x.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 59.
(107) §2.4 DIFFERENCE EQUATIONS . An LTI discrete system can also be described by a linear constant coefficient difference equation (LCCDE) of the form N M. ∑a k =0. k. y (n − k ) = ∑ bm x(n − m), ∀n m =0. if aN≠0, then the different equation is of order N. ; This equation describes a recursive approach for computing the current output, given the input values and previously computed output values. ; In practice this equation is computed forward in time, from n=-∞ to ∞. Therefore another form of this equation is ;. M. N. m =0. k =1. y (n) = ∑ bm x(n − m) − ∑ a k y (n − k ) FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 60.
(108) DIFFERENCE EQUATIONS . A solution to this equation can be obtained in the form y ( n) = y H ( n) + y P ( n) ; Where yH(n) is homogeneous part of the solution, is given by N. y H ( n) = ∑ c k z kn k =1. ;. zk, k=1,….N are N roots (also called natural frequencies) of the characteristic equation N k a z ∑ k =0 0. If the root zk satisfy the condition |zk|<1 for all k, then a casual system described by (2.19) is stable. ; The particular part of the solution, yP(n), is determined the righthand side of (2.19). In Chapter 4 we will discuss the analytical approach of solving difference equations using the z-transform . ;. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 61.
(109) Matlab IMPLEMENTATION . . A routine called filter is available to solve difference equations numerically, given the input and the difference equation coefficients. ; y=filter(b,a,x) where b=[b0,b1,…,bM] and a=[a0,a1,…,aN] are the coefficient arrays from the equation given in (2.19), and x is the input sequence array. ; The output y has the same length as input x. One must ensure that the coefficient a0 not be zero. To compute impulse response, MATLAB provides the function impz(b,a,n), where n is a vector for time range.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 62.
(110) EXAMPLE 2.9 . . Given the following difference equation y(n)-y(n-1)+0.9y(n-2)=x(n); a. Calculate and plot the impulse response h(n) at n=-20, …, 100. b. Calculate and plot the unit step response s(n) at n=-20,…, 100. c. Is the system specified by h(n) stable? Solution ~ ~ ~ ~ ~ ~. a=[1,-1,0.9];b=1; n=[-20:120]; x=impseq(0,-20,120); h=filter(b,a,x); h=impz(b,a,n) subplot(2,1,1);stem(n,h) axis([-20,120,-1.1,1.1]) title('Impulse Response');xlabel('n');ylabel('h(n)'). FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 63.
(111) EXAMPLE 2.9 . . % Part b) ; x=stepseq(0,-20,120); s=filter(b,a,x); ; subplot(2,1,2);stem(n,s);axis([-20,120,-.5,2.5]) ; title('Step Response');xlabel('n');ylabel('s(n)') ; The plot of the unit step response is shown in Figure 2.9 % Part c) ; Observe that h(n) is practically zero for n>120. Hence the system stability can be determined by sum(abs(h)). ; An alternate approach is using MATLAB’s root function. ~. z=roots(a); magz=abs(z); subplot. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 64.
(112) EXAMPLE 2.9 Impulse Response 1. h(n). 0.5 0 −0.5 −1 −20. 0. 20. 40. 60. 80. 100. 120. 80. 100. 120. n Step Response 2.5 2. s(n). 1.5 1 0.5 0 −0.5 −20. 0. 20. 40. 60 n. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 65.
(113) EXAMPLE 2.10 . . Let us consider the convolution given in Example 2.5. The input sequence is of finite duration x(n)=u(n)-u(n-10) while the impulse response is of infinite duration h(n)=(0.9)nu(n). Determine y(n)=x(n)*h(n) Solution: ; If one of the sequences is of infinite length, it is more suitable to use filter instead of conv function for numerical evaluation of the convolution. ; Given the impulse response h(n), one can compute a difference equation and then y(n) can be obtained from the filter function.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 66.
(114) EXAMPLE 2.10 . From the h(n) expression, h( n ) = (0.9) n u( n ) (0.9)h( n − 1) = (0.9)(0.9) n −1 u( n − 1) = (0.9) n u( n − 1) h( n ) − (0.9)h( n − 1) = (0.9) n u( n ) − (0.9) n u( n − 1) = (0.9) n [ u( n ) − u( n − 1)] = (0.9) n δ ( n ) = δ ( n ). . . h(n) is the output of an LTI system when the input is δ(n). Hence substituting x(n) for δ(n) and y(n) for h(n), the difference equation is y(n)-0.9y(n-1)=x(n). Now the filter(.) function can be used to compute the convolution indirectly.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 67.
(115) EXAMPLE 2.10 . Program : b = [1]; a = [1,-0.9]; n = -5:50; x = stepseq(0,-5,50) - stepseq(10,-5,50); y = filter(b,a,x); subplot(1,1,1); subplot(2,1,2); stem(n,y); title('Output sequence') xlabel('n'); ylabel('y(n)'); axis([-5,50,-0.5,8]). ~ ~ ~ ~ ~ ~. Output sequence 8. 7. 6. y(n). 5. 4. 3. 2. 1. 0 −5. 0. 5. 10. 15. 20. 25 n. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 68. 30. 35. 40. 45. 50.
(116) Zero-Input and Zero-State Responses . In DSP the difference equation is generally solved forward in time from n=0. Therefore initial conditions on x(n) and y(n) are necessary to determine the output for n>=0.. If y (n) =. M. N. m =0. k =1. ∑ bm x(n − m) − ∑ a k y (n − k ), n ≥ 0. Subject to the initial conditions: { y (n); − N ≤ n ≤ −1} and {x(n); − M ≤ n ≤ −1} . The solution can be expressed in alternative form y (n) = y ZI (n) + y ZS (n). FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 69.
(117) Zero-Input and Zero-State Responses . . . yZI(n): zero-input solution ; A solution due to the initial conditions alone yZS(n): zero-state solution ; A solution due to input x(n) alone Chapter 4 will discuss this topic.. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 70.
(118) Digital Filters . . Discrete-time LTI systems are also called digital filter. Classification ; FIR filter & IIR filter FIR filter ; Finite-duration impulse response filter ; Causal FIR filter : M y (n) = ∑ bm x(n − m) m =0. h(0)=b0,…,h(M)=bM ; Nonrecursive or moving average (MA) filter ; Difference equation coefficients, {bm} and {a0=1} ; Implementation in Matlab: conv(x,h); filter(b,1,x) (difference?) ;. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 71.
(119) Infinite Impulse Response (IIR) Filters . Infinite-duration impulse response filter Difference equation N ∑ ak y ( n − k ) = x ( n) k =0. . Recursive filter, in which the output y(n) is recursively. computed from its previously computed values Autoregressive (AR) filter. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 72.
(120) ARMA filter . Generalized IIR filter M. N. m =0. k =1. y ( n ) = ∑ bm x ( n − m ) − ∑ a k y ( n − k ), n ≥ 0 . It has two parts: MA part and AR part Autoregressive moving average filter, ARMA Solution ; filter(b,a,x); % given {bm}, {ak}. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 73.
(121) Homework . Textbook: pp7 to pp39 Exercises: ; P2.5, P2.10, P2.15, P2.16, P2.17, P2.19. FJU-EE – YUJL – Introduction DSP– Chapter2 - Page 74.
(122) Chapter 3. The Discrete-Time Fourier Analysis . Discuss discrete-time signal and system representation in the frequency domain. Study the sampling and reconstruction of analog signals.. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 1.
(123) §3.0 Introduction . . . A linear and time-invariant system can be represented using its response to the unit sample sequence. ; h(n) is called as the unit impulse response ; y(n)=x(n)*h(n): system response The convolution representation is based on the fact that. any signal can be represented by a linear combination of scaled and delayed unit samples. We can also represent any arbitrary discrete signal as a linear combination of basis signals introduced in Chapter 2.. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 2.
(124) §3.0 Introduction . . Each basis signal set provides a new signal representation. Each representation has some advantages and disadvantages depending upon the type of system under consideration. When the system is linear and time-invariant, only one representation stands out as the most useful. It is based and is on the complex exponential signal set {ejw} called the discrete-time Fourier Transform.. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 3.
(125) §3.1 The discrete-time Fourier transform (DTFT) . If x(n) is absolutely summable, i.e., DTFT is defined by +∞ DTFT :. X ( e jw ) = F [ x ( n )] =. ∑. ∑−∞ | x(n) |< ∞, the +∞. x ( n )e − jwn. n =−∞. 1 +π jw jwn IDTFT : x ( n ) = F [ X ( e )] = X e e dw ( ) ∫ − π 2π F[.] transforms a discrete signal x(n) into a complex-valued continuous function X of real variable w, called a digital frequency, which is measured in radians. −1. . ; ; ; ; ;. jw. Time domain ÅÆ Frequency domain Discrete ÅÆ Continuous Real valued ÅÆ Complex-valued Summation ÅÆ Integral The range of w: -∞~∞. The integral range of w: -π~ π. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 4.
(126) Example 3.1 . Determine the discrete-time Fourier transform of x(n) = (0.5) n u (n) e jw ⇒ DTFT = X ( e ) = jw e − 0.5 jw. . Result visualization with Matlab ; Complex function: magnitude and angle; ; real/imaginary part with respect to w ; The range of w: −∞ ~ +∞ ; showing interval: [0,pi]. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 5.
(127) Example 3.1 Real Part 2. 1.8. 1.8. 1.6. 1.6. 1.4. 1.4. Real. Magnitude. Magnitude Part 2. 1.2. 1.2. 1. 1. 0.8. 0.8 0. 0.2. 0.4 0.6 0.8 frequency in pi units. 1. 0. 0.2. 0. −0.1. −0.1. −0.2. −0.2. −0.3 −0.4. −0.3 −0.4. −0.5. −0.5. −0.6. −0.6. −0.7. 0. 0.2. 0.4 0.6 0.8 frequency in pi units. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 6. 1. Imaginary Part. 0. Imaginary. Radians. Angle Part. 0.4 0.6 0.8 frequency in pi units. 1. −0.7. 0. 0.2. 0.4 0.6 0.8 frequency in pi units. 1.
(128) Two important properties . . Periodicity: jw j [ w + 2π ] X ( e ) = X ( e ) ; The DTFT is periodic in w with period 2πÆ ; Implication: we need only one period for analysis and not the whole domain Symmetry: − jw * jw ; For real-valued x(n), X is conjugate symmetric. X (e ) = X (e ) ; Implication: to plot X, we now need to consider only a half of X: [0, π] Re[ X ( e − jw )] = Re[ X ( e jw )] even symmetry Im[ X ( e − jw )] = − Im[ X ( e jw )] odd symmetry | X ( e − jw ) |=| X ( e jw ) |. even symmetry. ∠X ( e − jw )] = −∠X ( e jw ). odd symmetry. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 7.
(129) Matlab Implementation . . If x(n) is of infinite duration, then Matlab can not be used directly to compute X from x(n). We can use DTFT to evaluate the expression X over [0, π] frequencies and then plot its magnitude and angle (or real and imaginary parts) as in Example 3.1. For a finite duration, the DTFT can be implemented as a matrix-vector multiplication operation if X is evaluated at equispaced frequency between [0, π].. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 8.
(130) Matlab Implementation . If x(n) has N samples over n1≦n≦nN and we want to evaluate X at wk=π/(Mk), k=0, 1, … M.. X (e. jwk. ) = ∑ p =1 x ( n p )e N. − j (π / M ) kn p. = W( k ,:)x. W( k ,:) = [e − j (π / M ) kn1 " e − j (π / M ) knN ] x = [ x ( n1 )" x ( nN )]T . Stack X(ejwk) into vector form. X = [ X ( e jw0 )" X ( e jwM )]T = Wx W = {e. − j ( π / M ) kn p. , 1 ≤ p ≤ N , k = 0,1," , M }. π ⎡ ⎛ T ⎞⎤ = x ⎢exp ⎜ − j kn ⎟ ⎥ , k , n ∈ column vector ⎝ M ⎠⎦ ⎣ T. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 9.
(131) Example 3.4 . If x(n) is of infinite duration, x(n)={1,2,3,4,5}, -1≦n≦3, determine DTFT. Solution: the vectors are in row vector form 1. n=-1:3; x=1:5; 2. K=0:500; w=(pi/500)*k; 3. X=x*(exp(-j*pi/500).^(n’*k); 4. magX=abs(X); angX=angle(X); 5. realX = real(X); imagX = imag(X); 6. subplot(2,2,1); plot(k/500,magX); grid; 7. xlabel(‘frequency in pi unit’); title(‘Magnitude Part’);. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 10.
(132) Example 3.4 Magnitude Part. Real Part. 16. 15. 14 10. 10. Real. Magnitude. 12. 8 6. 5. 0. 4 2. 0. 0.2. 0.4 0.6 0.8 frequency in pi units. −5. 1. 0. 0.2. Angle Part. 0.4 0.6 0.8 frequency in pi units. 1. Imaginary Part. 4. 4 2 0 Imaginary. Radians. 2. 0. −2 −4 −6. −2. −8 −4. 0. 0.2. 0.4 0.6 0.8 frequency in pi units. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 11. 1. −10. 0. 0.2. 0.4 0.6 0.8 frequency in pi units. 1.
(133) Example 3.5 . Let x(n)= [0.9exp(jπ/3)n], 0≦n≦10. Determine X(ejwk) and study its periodicity. The DTFT of complex-valued signal is periodic in w but it is not conjugate-symmetric. Magnitude Part 8. |X|. 6. 4. 2. 0 −2. −1.5. −1. −0.5 0 0.5 frequency in units of pi. 1. 1.5. 2. 1. 1.5. 2. Angle Part 1. radians/pi. 0.5. 0. −0.5. −1 −2. −1.5. −1. −0.5 0 0.5 frequency in units of pi. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 12.
(134) Example 3.6 . Let x(n)= 2n, -10≦n≦10. Determine X(ejwk) and study its periodicity. ; The DTFT of real-valued signal is periodic and conjugatesymmetric. ; Therefore for real sequence we will plot their Fourier transform magnitude and angle responses from 0 to pi. Magnitude Part 15. |X|. 10. 5. 0 −2. −1.5. −1. −0.5 0 0.5 frequency in units of pi. 1. 1.5. 2. 1. 1.5. 2. Angle Part 1. radians/pi. 0.5. 0. −0.5. −1 −2. −1.5. −1. −0.5 0 0.5 frequency in units of pi. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 13.
(135) §3.2 The properties of the DTFT . . . 1. Linearity: ; The DTFT is a linear transformation. F [α x1 ( n ) + β x2 ( n )] = α F [ x1 ( n )] + β F [ x2 ( n )] 2. Time shifting: ; A shift in the time domain corresponds to the phase shifting. F [ x ( n − k )] = X ( e jw )e − jwk 3. Frequency shifting: ; Multiplication by a complex exponential corresponds to a shift in the frequency domain.. F [ x ( n )e jw0n ] = X ( e j ( w− w0 ) ). FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 14.
(136) The properties of the DTFT . . . 4. Conjugation: ; Conjugation in the time domain corresponds to the folding and conjugation in the frequency domain. F [ x* ( n )] = X * ( e − jw ) 5. Folding: ; Folding in the time domain corresponds to the folding in the − jw F [ x ( − n )] = X ( e ) frequency domain 6. Symmetries in real sequence: ;. Implication: If the sequence x(n) is real and even, then X is also real and even. x ( n ) = x ( n ) + x ( n ) e. o. F [ xe ( n )] = Re[ X ( e jw )] F [ xo ( n )] = j Im[ X ( e jw )] FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 15.
(137) The properties of the DTFT . . . 7. Convolution: F [ x1 ( n ) * x2 ( n )] = F [ x1 ( n )]F [ x2 ( n )] = X 1 ( e jw ) X 2 ( e jw ) 8. Multiplication ; Periodic convolution (discussed in Chapter 5) F [ x1 ( n ) ⋅ x2 ( n )] = F [ x1 ( n )] ⊗ F [ x2 ( n )] 9. Energy. = (1/ 2π ) ∫ X 1 ( e jθ ) X 2 ( e j ( w−θ ) )dθ. +∞. 1 ε x = ∑ | x(n) | = 2π −∞ 2. Φ x ( w) =. | X ( e jw ) |2. π. +π. ∫π −. | X ( e jw ) |2 dw : Parseval's Theorem. : energy density spectrum. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 16.
(138) Example 3.9 . Let x(n)= cos(nπ/2), 0≦n≦100 and y(n)=ejnπ/4 x(n). Verify the frequency shift property by using Matlab. Magnitude of X. Angle of X. 60. 1. 50 0.5. radiands/pi. |X|. 40 30 20. 0. −0.5 10 0 −1. −0.5 0 0.5 frequency in pi units. −1 −1. 1. Magnitude of Y. −0.5 0 0.5 frequency in pi units. 1. Angle of Y. 60. 1. 50 0.5. radians/pi. |Y|. 40 30 20. 0. −0.5 10 0 −1. −0.5 0 0.5 frequency in pi units. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 17. 1. −1 −1. −0.5 0 0.5 frequency in pi units. 1.
(139) Example 3.12 . Let x(n)= sin(nπ/2), -5≦n≦10. Verify the symmetry property by using Matlab. Imaginary part of X 10. 1. 5. Im(X). Re(X). Real part of X 2. 0. −1. −2 −1. 0. −5. −0.5 0 0.5 frequency in pi units. −10 −1. 1. 10. 1. 5. 0. −1. −2 −1. 1. Transform of odd part. 2. XO. XE. Transform of even part. −0.5 0 0.5 frequency in pi units. 0. −5. −0.5 0 0.5 frequency in pi units. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 18. 1. −10 −1. −0.5 0 0.5 frequency in pi units. 1.
(140) §3.3 The frequency domain representation of LTI system . . The Fourier transform representation is the most useful signal representation for LTI systems. It is due to the following result: ; Response to a complex exponential ejw0n ; Response to sinusoidal sequences ; Response to arbitrary sequences Those responses are called the stead-state responses of systems.. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 19.
(141) Response to a complex exponential . Response to a complex exponential. e . jw0 n. h(n) * e jw0 n = [ F [h(n)] |w= w0 ]e jw0 n. h(n). Frequency response: the DTFT of an impulse response is called the frequency response (or transfer function) of an LTI system and is denoted by H().. H ( e ) = F [h( n )] = ∑ n =−∞ h( n )e jnw ∞. jw. jw0 jw0 n H ( e ) × e H ( e ) e The output sequence is the input exponential sequence modified by the response of the system at frequency w0. jw0 n. . jw. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 20.
(142) Response to a complex exponential . Response to multiple complex exponential sequences. ∑ Ak e k. . jwk n. jw. H (e ), h(n). jwk jwk n A H ( e ) e ∑ k k. In general, the frequency response H is a complex function of w. ; The magnitude |H| is called the magnitude (gain) response function, and ; the the angle is called the phase response function.. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 21.
(143) Response to sinusoidal sequences . Response to x(n)= Acos(w0n+θ0), cos( w0 n + θ 0 ). h(n). y (n) = ?. x ( n ) = A cos( w0 n + θ 0 ) y ( n ) = A | H ( e jw0 ) | cos( w0 n + θ 0 + ∠H ( e jw0 )) x ( n ) = ∑ Ak cos( wk n + θ k ) k. y ( n ) = ∑ Ak | H ( e jw0 ) | cos( wk n + θ k + ∠H ( e jw0 )) k. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 22.
(144) Response to arbitrary sequences . Let X=F[x(n)] and Y=F[y(n)]. Then using convolution property, we have. x(n). h(n). jw. H (e jw ), h(n). X (e ). FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 23. y ( n) = h( n) * x ( n). Y (e jw ) = H (e jw ) X (e jw ).
(145) Example 3.13 . Plot the magnitude and the phase responses of a system characterized by h(n)=(0.9)nu(n). 1 X (e ) = 1 − 0.9e − jw jw. Magnitude Response 10 8. |H|. 6 4 2 0. 0. 0.1. 0.2. 0.3. 0.4 0.5 0.6 frequency in pi units. 0.7. 0.8. 0.9. 1. 0.7. 0.8. 0.9. 1. Phase Response. Phase in pi Radians. 0. −0.1. −0.2. −0.3. −0.4. 0. 0.1. 0.2. 0.3. 0.4 0.5 0.6 frequency in pi units. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 24.
(146) Frequency response function from difference equations . To evaluate its frequency response , we would need the impulse response h(n). How do we do when an LTI system is represented by the difference equation?. y (n) + ∑l =1 al y (n − l ) = ∑m =0 bm x(n − m) N. . We know that when. M. x(n) = e jwn , then y(n) must be. H (e jw )e jwn Therefore,. − jwm b e ∑m =0 m M. H (e jw ) =. 1 + ∑l =0 al e − jwl. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 25. N.
(147) Example 3.15 . An LTI system is specified by y(n)=0.8y(n-1)+x(n). (a.) Determine X(ejw) and (b.) Plot the steady-state response to x(n)=cos(0.05nπ)u(n) Input sequence 1. x(n). 0.5. 0. −0.5. −1. 0. 10. 20. 30. 40. 50 n. 60. 70. 80. 90. 100. 60. 70. 80. 90. 100. Output sequence. y(n). 5. 0. −5. 0. 10. 20. 30. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 26. 40. 50 n.
(148) Example 3.16 . We can generalize the frequency response by using a simple matrix-vector multiplication. − jwm b e ∑ m =0 m M. H ( e jw ) = . 1 + ∑ n =0 al e − jwn N. If X is evaluated at equispaced frequency between [0, π] with K points. H ( e jw ) = b exp( − jmT w ). / a exp( − jnT w ) b = [b0 , b1 ," bM ]; a = [a0 , a1 ," a N ] m = [0,1, 2," , M ]; n = [0,1, 2," , N ] k = [0,1, 2," , K ]; w = pi * k / K FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 27.
(149) Example 3.16 . A 3rd-order lowpass filter with difference equation y ( n ) = 0.0181x ( n ) + 0.0543x ( n − 1) + 0.0543 x ( n − 2) + 0.0181x ( n − 3) + 1.76 y ( n − 1) − 1.1829 y ( n − 2) + 0.2781 y ( n − 3) 1. 2. 3. 4. 5. 6. 7. 8. 9.. b = [0.0181, 0.0543, 0.0543, 0.0181]; a = [1.0000, -1.7600, 1.1829, -0.2781]; m = 0:length(b)-1; l = 0:length(a)-1; K = 500; k = 1:1:K; w = pi*k/K; % [0, pi] axis divided into 501 points. num = b * exp(-j*m'*w); % Numerator calculations den = a * exp(-j*l'*w); % Denominator calculations H = num ./ den; magH = abs(H); angH = angle(H);. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 28.
(150) Example 3.16 . A 3rd-order lowpass filter with difference equation Magnitude Response 1 0.8. |H|. 0.6 0.4 0.2 0. 0. 0.1. 0.2. 0.3. 0.4 0.5 0.6 frequency in pi units. 0.7. 0.8. 0.9. 1. 0.7. 0.8. 0.9. 1. Phase Response. Phase in pi Radians. 1. 0.5. 0. −0.5. −1. 0. 0.1. 0.2. 0.3. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 29. 0.4 0.5 0.6 frequency in pi units.
(151) §3.4 Sampling and reconstruction of analog signals . . . . Analogy signals can be converted into discrete signals using sampling and quantization operations: analogy-todigital conversion, or ADC Digital signals can be converted into analog signals using a reconstruction operation: digital-to-analogy conversion, or DAC Using Fourier analysis, we can describe the sampling operation from the frequency-domain view-point, analyze its effects and then address the reconstruction operation. We will also assume that the number of quantization levels is sufficiently large that the effect of quantization on discrete signals is negligible.. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 30.
(152) Sampling . . Let xa(t) be analog signal. We have FT/IFT pair +∞ IFT 1 +∞ jΩ t − jΩ t ⎯⎯→ X a ( jΩ) = ∫ xa (t )e dt ←⎯⎯ xa (t ) = X j Ω e dΩ ( ) a ∫ FT −∞ −∞ 2π ; Assume xa(t) is Absolutely integrable ; Ω(or F) is an analogy frequency in radians/sec ; ω (or f) is a digital frequency radians/sec ; Analogy and digital frequencies are related through sampling rate Fs=1/Ts, ω=Ω/Fs, f=F/Fs. Sampling: Sample xa(t) at sampling interval Ts sec apart to obtain the discrete-time signal x(n) x ( n ) = xa (t = nTs ) 1 ⇒ X s (ω ) = Ts. 2π ∑n X a ( T − T n) s s. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 31. ω.
(153) Sampling. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 32.
(154) Sampling . Fig3.10. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 33.
(155) Sampling . . X is a countable sum of amplitude-scaled, frequency-. scaled, and translated version of xa(t) The above relation is known as the aliasing formula Suppose signal band is limited to ±Ώ0, If Ts is small, Ώ0Ts<πÆ Ώ0<π/Ts, or ; F0= Ώ0/2π < 1/2Ts = Fs/2 Æ Fs>2 F0 ; Then the frequency spectrum of x(t) is an infinite replica series of its analog signal xa(t), If Ts is large, Ώ0Ts>π Æ Ώ0>π/Ts, or ; F0= Ώ0/2π > 1/2Ts = Fs/2 Æ Fs<2 F0 ; Then the frequency spectrum of x(t) is a overlaped replica of its analog signal xa(t), so cannot be reconstructed. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 34.
(156) Sampling . Sampling: p(t ) = ∑ δ (t − nTs ) = ∑ cn e n. 1 P (Ω) = Ts. j 2π nFs t. n. 1 = Ts. j 2π nFs t , Fs = 1/ Ts e ∑ n. 1 ∑n δ (Ω − nΩ s ) or P( F ) = T s. ∑ δ ( F − nF ), Ω s. n. x s ( t ) = xa ( t ) p ( t ) ⇒ X s ( Ω ) = X a ( Ω ) ∗ P ( Ω ) 1 X s (Ω) = X a (Ω) ∗ P(Ω) = ∑ X a (Ω − nΩ s ) Ts n 1 Ω ⇒ X s (ω ) ≡ X s ( ) = Fs Ts 1 = Ts. ∑X. a. (ω Fs − nΩ s ). n. ω. 2π ∑n X a ( T − T n) s s. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 35. s. = 2π Fs.
(157) Ban-limited signal . A signal is band-limited if there exists a finite radians frequency Ώ0 such that Xa(Ώ) is zero for |Ώ|> Ώ0. ;. The frequency F0= Ώ0 /2π is called the signal bandwidth in Hz. ;. Referring to Fig.3.10, if π> Ώ0Ts , or Fs>2 F0 then ⎛ w⎞ 1 π w π X (e ) = X a ⎜⎜ j ⎟⎟; − < ≤ Ts Ts Ts Ts ⎝ Ts ⎠ jw. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 36.
(158) Sampling Principle . . A band-limited signal xa(t) with bandwidth F0 can be reconstructed from its sample values x(n)=xa(nTs) if the sampling frequency Fs=1/Ts is greater than twice the bandwidth F0 of xa(t) , Fs >2 F0. Otherwise aliasing would result in x(n). The sampling rate of 2F0 for an analog band-limited signal is called the Nyquist rate.. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 37.
(159) Example 3.17 . Let xa(t)=exp(-1000|t|). Determine and plot its Fourier transform. 0.002 ; Ideal : X a (Ω) = 1 + (Ω /1000)2 ;. Using DTFT : X a ( jΩ ) = ∫. +∞. −∞. xa (t )e − jΩt dt ≈ ∑ m xa ( mΔt )e − jΩmΔt Δt. Selection of Δt : Xa(Ω)≒0 for Ω≧(2π)2000 or F≧2000. Therefore, Δt should be ≦1/4000. We set Δt=0.00005 ; Selection of time period of xa(t) : -5m≦t≦5m since exp(-5)≒0. ;. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 38.
(160) Example 3.17 % Analog Signal 2. Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); 3. %% Continuous-time Fourier Transform 4. Wmax = 2*pi*2000; K = 500; k = 0:1:K; W = k*Wmax/K; 5. Xa = xa * exp(-j*t'*W) * Dt; Xa = real(Xa); 6. W = [-fliplr(W), W(2:501)]; % Omega from -Wmax to Wmax 7. Xa = [fliplr(Xa), Xa(2:501)]; 8. subplot(2,1,1);plot(t*1000,xa); 9. xlabel('t in msec.'); ylabel('xa(t)'); title('Analog Signal') 10. subplot(2,1,2);plot(W/(2*pi*1000),Xa*1000); 11. xlabel('Frequency in KHz'); ylabel('Xa(jW)*1000') 12. title('Continuous-time Fourier Transform') 1.. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 39.
(161) Example 3.17 Analog Signal 1. xa(t). 0.8 0.6 0.4 0.2 0 −5. −4. −3. −2. −1. 0 t in msec.. 1. 2. 3. 4. 5. Continuous−time Fourier Transform 2. Xa(jW)*1000. 1.5. 1. 0.5. 0 −2. −1.5. −1. −0.5. 0 0.5 Frequency in KHz. FJU-EE – YUJL – Introduction DSP– Chapter3 - Page 40. 1. 1.5. 2.
相關文件
Al atoms are larger than N atoms because as you trace the path between N and Al on the periodic table, you move down a column (atomic size increases) and then to the left across
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 5: Computer Architecture slide
Salas, Hille, Etgen Calculus: One and Several Variables Copyright 2007 © John Wiley & Sons, Inc.. All
Salas, Hille, Etgen Calculus: One and Several Variables Copyright 2007 © John Wiley & Sons, Inc.. All
1 As an aside, I don’t know if this is the best way of motivating the definition of the Fourier transform, but I don’t know a better way and most sources you’re likely to check
+ Time to restore the CPU’s context of the highest priority task + Time to execute the return from interrupt instruction.. ISR
Since the assets in a pool are not affected by only one common factor, and each asset has different degrees of influence over that common factor, we generalize the one-factor
In Chapter 3, we transform the weighted bipartite matching problem to a traveling salesman problem (TSP) and apply the concepts of ant colony optimization (ACO) algorithm as a basis