Nov '05CS3291 : Section 81 UNIVERSITY of MANCHESTER Department of Computer Science CS3291 Digital Signal Processing ‘05 Section 8 Introduction to the DFT.

Slides:



Advertisements
Similar presentations
DCSP-12 Jianfeng Feng
Advertisements

DCSP-13 Jianfeng Feng
DCSP-13 Jianfeng Feng Department of Computer Science Warwick Univ., UK
1 Chapter 16 Fourier Analysis with MATLAB Fourier analysis is the process of representing a function in terms of sinusoidal components. It is widely employed.
Filtering Filtering is one of the most widely used complex signal processing operations The system implementing this operation is called a filter A filter.
Digital Signal Processing – Chapter 11 Introduction to the Design of Discrete Filters Prof. Yasser Mostafa Kadah
Digital Signal Processing
Chapter 8: The Discrete Fourier Transform
MM3FC Mathematical Modeling 3 LECTURE 10 Times Weeks 7,8 & 9. Lectures : Mon,Tues,Wed 10-11am, Rm.1439 Tutorials : Thurs, 10am, Rm. ULT. Clinics : Fri,
FFT-based filtering and the Short-Time Fourier Transform (STFT) R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003.
Sampling, Reconstruction, and Elementary Digital Filters R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2002.
Chapter 12 Fourier Transforms of Discrete Signals.
Discrete Fourier Transform(2) Prof. Siripong Potisuk.
Continuous-Time Signal Analysis: The Fourier Transform
Spectral Analysis Spectral analysis is concerned with the determination of the energy or power spectrum of a continuous-time signal It is assumed that.
AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters.
Over-Sampling and Multi-Rate DSP Systems
Random Processes and LSI Systems What happedns when a random signal is processed by an LSI system? This is illustrated below, where x(n) and y(n) are random.
Goals For This Class Quickly review of the main results from last class Convolution and Cross-correlation Discrete Fourier Analysis: Important Considerations.
FT Representation of DT Signals:
EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
Discrete-Time and System (A Review)
DTFT And Fourier Transform
1 Chapter 8 The Discrete Fourier Transform 2 Introduction  In Chapters 2 and 3 we discussed the representation of sequences and LTI systems in terms.
GCT731 Fall 2014 Topics in Music Technology - Music Information Retrieval Overview of MIR Systems Audio and Music Representations (Part 1) 1.
Lecture 1 Signals in the Time and Frequency Domains
Motivation Music as a combination of sounds at different frequencies
Fourier Transforms Section Kamen and Heck.
Nov'04CS3291: Section 41 University of Manchester Department of Computer Science CS3291 Digital Signal Processing '04-'05 Section 4: ‘A design technique.
Digital Signal Processing
16 Oct'09Comp30291 Section 31 University of Manchester School of Computer Science Comp30291: Digital Media Processing Section 3 : Discrete-time.
8.1 representation of periodic sequences:the discrete fourier series 8.2 the fourier transform of periodic signals 8.3 properties of the discrete fourier.
FOURIER ANALYSIS PART 2: Continuous & Discrete Fourier Transforms
Digital Signal Processing – Chapter 10
Chapter 5 Frequency Domain Analysis of Systems. Consider the following CT LTI system: absolutely integrable,Assumption: the impulse response h(t) is absolutely.
1 BIEN425 – Lecture 10 By the end of the lecture, you should be able to: –Describe the reason and remedy of DFT leakage –Design and implement FIR filters.
Zhongguo Liu_Biomedical Engineering_Shandong Univ. Chapter 8 The Discrete Fourier Transform Zhongguo Liu Biomedical Engineering School of Control.
Nov'04CS3291 DSP Sectn 51 University of Manchester Department of Computer Science CS 3291 : Digital Signal Processing Section 5: z-transforms & IIR-type.
Real time DSP Professors: Eng. Julian S. Bruno Eng. Jerónimo F. Atencio Sr. Lucio Martinez Garbino.
Chapter 5 Finite-Length Discrete Transform
revision Transfer function. Frequency Response
Lecture#10 Spectrum Estimation
Digital Media Processing
DTFT continue (c.f. Shenoi, 2006)  We have introduced DTFT and showed some of its properties. We will investigate them in more detail by showing the associated.
Signals and Systems, 2/E by Simon Haykin and Barry Van Veen Copyright © 2003 John Wiley & Sons. Inc. All rights reserved. Figure 4.1 (p. 343) FS and FT.
Fourier Analysis Using the DFT Quote of the Day On two occasions I have been asked, “Pray, Mr. Babbage, if you put into the machine wrong figures, will.
Lecture 3: The Sampling Process and Aliasing 1. Introduction A digital or sampled-data control system operates on discrete- time rather than continuous-time.
What is filter ? A filter is a circuit that passes certain frequencies and rejects all others. The passband is the range of frequencies allowed through.
Math for CS Fourier Transforms
بسم الله الرحمن الرحيم Digital Signal Processing Lecture 14 FFT-Radix-2 Decimation in Frequency And Radix -4 Algorithm University of Khartoum Department.
1 Chapter 8 The Discrete Fourier Transform (cont.)
 Carrier signal is strong and stable sinusoidal signal x(t) = A cos(  c t +  )  Carrier transports information (audio, video, text, ) across.
Lecture 19 Spectrogram: Spectral Analysis via DFT & DTFT
Chapter 4 Discrete-Time Signals and transform
CS 591 S1 – Computational Audio
DIGITAL SIGNAL PROCESSING ELECTRONICS
Spectral Analysis Spectral analysis is concerned with the determination of the energy or power spectrum of a continuous-time signal It is assumed that.
FFT-based filtering and the
Sampling rate conversion by a rational factor
EE Audio Signals and Systems
Fourier Analysis of Signals Using DFT
Ideal Filters One of the reasons why we design a filter is to remove disturbances Filter SIGNAL NOISE We discriminate between signal and noise in terms.
Chapter 8 The Discrete Fourier Transform
Chapter 8 The Discrete Fourier Transform
Chapter 8 The Discrete Fourier Transform
Fast Fourier Transform (FFT) Algorithms
Lec.6:Discrete Fourier Transform and Signal Spectrum
Electrical Communication Systems ECE Spring 2019
CE Digital Signal Processing Fall Discrete Fourier Transform (DFT)
Fourier Transforms of Discrete Signals By Dr. Varsha Shah
Presentation transcript:

Nov '05CS3291 : Section 81 UNIVERSITY of MANCHESTER Department of Computer Science CS3291 Digital Signal Processing ‘05 Section 8 Introduction to the DFT

Nov '05CS3291 : Section 82 DTFT of {x[n]} is: If {x[n]} obtained from x a (t), correctly bandlimited then: for -  <  <  :  =  T DTFT is convenient way of calculating X a (j  ) by computer.

Nov '05CS3291 : Section 83 Two difficulties: (i)Infinite range of summation (ii) X(e j  ) is continuous function of  Solutions: (i) Time-domain windowing: Restrict {x[n]} to { x[0], x[1], … x[N-1]}  {x[n]} 0, N-1 (ii) Frequency-domain sampling: Store values of X(e j  ) for -  <  <  For real signals we only need 0   <  but generalise to complex signals Instead of -  <  <  take 0   < 2 

Nov '05CS3291 : Section 84 Why take 0   < 2  ? X(e j  ) = X( e j (  + 2  ) ) for any  So for X(e - j  / 3 ) look up X(e j 5  / 3 ). Same information, & it is convenient for  to start off at 0. In many cases, not interested in  > 

Nov '05CS3291 : Section 85 Taking M equally spaced samples over 0   < 2  we get : { X[k] } 0, M-1  { X[0], X[1],…, X[M-1] } where X[k] = X(exp(j  k )) with  k = 2  k/M

Nov '05CS3291 : Section 86 For spectral analysis, the larger M, the better for drawing accurate graphs etc. But, if we need minimum M for storage of unambiguous spectrum, take M=N. DFT: {x[n]} 0, N-1  {X[k]} 0, N-1  (complex) (complex)  k = 2  k/N

Nov '05CS3291 : Section 87 DFT transforms a finite sequence to another finite sequence. DTFT transforms infinite sequence to continuous functn of  Inverse DFT: {X[k]} 0, N-1  {x[n]} 0, N-1 Note Similarity with DFT:

Nov '05CS3291 : Section 88 Programming the DFT & its inverse:  k = 2  k/N Similarity exploited by programs able to perform DFT or its inverse using same code. Programs to implement these equations in a ‘direct’ manner given in MATLAB (using complex arith) & C (using real arith only). These ‘direct’ programs are very slow & FFT is much faster.

Nov '05CS3291 : Section 89 % Given N complex time-domain samples in array x[1:N] E = 2*pi/N ; for k=0 : N-1 X(1+k) = 0 + j*0 ; Wk =k*E ; for L = 0 : N-1 C = cos(L*Wk) + j *sin(L*Wk); X(1+k) = X(1+k) + x(1+L) * C; end; % Now have N complex freq-dom samples in array X[1:N] Direct DFT using complex arithmetic in MATLAB

Nov '05CS3291 : Section 810 % Given N complex freq-domain samples in array x[1:N] E = -2*pi/N ; for k=0 : N-1 X(1+k) = 0 + j*0 ; Wk =k*E ; for L = 0 : N-1 C = cos(L*Wk) + j *sin(L*Wk); X(1+k) = X(1+k) + x(1+L) * C; end; X(1+k) = X(1+k)/N ; end; % Now have N complex time-dom samples in array X[1:N] Direct inverse DFT using complex arithmetic in MATLAB

Nov '05CS3291 : Section 811 % Given N complex samples in array x[1:N] if (Invers == 1) E = -2*pi/N else E = 2*pi/N ; for k=0 : N-1 X(1+k) = 0 + j*0 ; Wk =k*E ; for L = 0 : N-1 C = cos(L*Wk) + j *sin(L*Wk); X(1+k) = X(1+k) + x(1+L) * C; end; if (Inverse == 1) X(1+k) = X(1+k)/N ; end; % Now have N complex samples in array X[1:N] Direct forward/inverse DFT using complex arith in MATLAB

Nov '05CS3291 : Section 812 // Direct fwd/inverse DFT using real arith only in ‘C’ void directdft(void) // DFT or Inverse DFT by direct method. { // Order=N, Real & imag parts of input in arrays xr & xi // Output:- Real part in array X, Imag part in Y // Invers is 0 for DFT, 1 for IDFT int k, L; float c,e,s,wk; if(Invers==1) e = -2.0*PI/(float)N; else e = 2.0*PI/(float)N; for(k=0;k<N;k++) { x[k]=0.0; y[k]=0.0 ; wk=(float)k*e ; for(L=0; L<N; L++) { c=cos(L*wk); s=sin(L*wk); x[k] = x[k] + xr[L]*c + xi[L]*s; y[k] = y[k] + xi[L]*c - xr[L]*s;} if(Invers==1) { x[k]=x[k]/(float)N; y[k]=y[k]/(float)N;} }

Nov '05CS3291 : Section 813 Fast Fourier Transform (FFT) An FFT algorithm, programmed in "C ", is presented in Table 2. Gives ‘exactly’ same results as DFT only much faster. Its detail & how speed is achieved is outside our syllabus. We are interested in how to use DFT & interpret its results. MATLAB has efficient fft procedure in its ‘SP tool-box'. Don’t need to know how it’s programmed, only how to use it! Direct DFT programs of academic interest only. Table 4 is MATLAB program which reads music from a 'wav' file, splits it up into 512 sample sections & performs a DFT (by FFT) analysis on each section.

Nov '05CS3291 : Section 814 Effect of windowing (old) DFT of {x[0], x[1],..., x[N-1] } is frequency-sampled version of DTFT of infinite sequence {x[n]} with all samples outside range n= 0 to N-1 set to zero. {x[n]} effectively multiplied by "rectangular window" {r[n]} When N is even, the DTFT, R(e j  ) of {r[n]} is: Dirichlet Kernel

Nov '05CS3291 : Section 815 Effect of windowing (newer) Given {x[n]} 0,N-1  {x[0], x[1],..., x[N-1] } Assumed obtained by multiplying infinite sequence {x[n]} by "rectangular window" {r[n]} When N is even, the DTFT, R(e j  ) of {r[n]} is: Dirichlet Kernel

Nov '05CS3291 : Section 816 Effect of windowing Given {x[n]} 0,N-1  {x[0], x[1],..., x[N-1] } Assumed obtained by multiplying infinite sequence {x[n]} by "rectangular window" {r[n]} r[n] 0 N n

Nov '05CS3291 : Section 817 When N is even, the DTFT, R(e j  ) of {r[n]} is: Dirichlet Kernel

Nov '05CS3291 : Section 818 sincs 10 (  /(2  )) plotted against  :  --

Nov '05CS3291 : Section 819  --

Nov '05CS3291 : Section 820 Notation “sincs M (  /(2  ))” is not in textbooks. This function is also encountered when designing FIR filters. Causes the stop-band ripples which appear when FIR low-pass filters are designed with rectangular windows. Magnitude of R(e j  ) shown above when M=10. Note relatively narrow main lobe & side-lobes. Zero-crossings occur at  =  2  / M,  4  / M, etc. Like a "sinc" function in many ways.

Nov '05CS3291 : Section 821 Frequency-domain convolution: DTFT of product of {x[n]} & {r[n]} is complex ( freq.-domain) convolution between X(e j  ) & R(e j  ) denoted X(e j  )  R(e j  ): Observe the form of this expression & its similarity with time-domain convolution formulae. Also note the (1/2  ) factor & limits -  to  which may remind us of the inverse DTFT.

Nov '05CS3291 : Section 822 Duality of time- & frequency-domain convolution (i) Fourier transform of h(t)  x(t) is H(j  ).X(j  ). (ii) DTFT of {h[n]}  {x[n]} is H(e j  ).X(e j  ) Time-domain Frequency-domain Convolution (filtering) Multiplication Multiplication(windowing) Complex convolution

Nov '05CS3291 : Section 823 Duality of time- & frequency-domain convolution Time-domain Frequency-domainConvolution (filtering) Multiplication Multiplication(windowing) Complex convolution

Nov '05CS3291 : Section 824   (1/2  )  (  (  -  0 ) +  (  +  0 ) ) e j  n d   = (1/2)[ e j  o n + e -j  o n ] = cos (  0 n) for -  < n <  It may be inferred that DTFT of {cos(  0 n) } is:   (  -  0 ) +   (  +  0 ) Spectral analysis of sampled sine-waves DTFT of {cos(  0 n)} cannot be found directly. But inverse DTFT of X(e j  ) =   (  -  0 ) +   (  +  0 ) is:

Nov '05CS3291 : Section 825  --   -0-0 00 X(e j  ) DTFT of {cos(  n)}

Nov '05CS3291 : Section 826 DTFT of rectangularly windowed sampled sine-wave DTFT of {cos  0 n} 0,N-1 = DTFT of {x[n].r[n]} = X(e j  )  R(e j  ) = P(e j  ) say. By frequency-domain convolution formula, 00  --   -0-0 X(e j  ) R(e j(  -  ) ) 

Nov '05CS3291 : Section 827 00  --   -0-0 X(e j  ) R(e j(    ) ) 

Nov '05CS3291 : Section 828 X(e j  ) =   (  -  0 ) +   (  +  0 ) Now draw this & its modulus:

Nov '05CS3291 : Section 829  0 0 - 0- 0 P(e j  )

Nov '05CS3291 : Section 830 | P(e j  ) |  0

Nov '05CS3291 : Section 831 When rectangular window is of width N samples: Ampl of main peak = ampl of sine-wave*N/2 check! N-1 zero-crossings between 0 and . 1 main peak & N-2 ripples in magnitude spectrum. Increasing N gives sharper peak & more ripples.

Nov '05CS3291 : Section 832 Effect of windowing on DFT : Effect on DTFT is frequency spreading & side lobes. How does windowing with frequency sampling affect the DFT? Effect is rather confusing Consider 64 pt DFT of { cos(0.7363n)} in Fig 1.  0 = lies between  7 = (2  /64)*7 &  8 = (2  /64)*8 Samples of rectangular window seen. X[7] and X[8] strongly affected by sinusoid.

Nov '05CS3291 : Section 833 Amplitude  20 Fig 1 : Magnitude of 64 pt DFT spectrum of cos(0.7363n)

Nov '05CS3291 : Section 834 Now consider 64 pt DFT of { cos (n  /4) } in Fig 2  0 =  /4 coincides exactly with  8. Only X[8] affected.

Nov '05CS3291 : Section 835 Ampl. = 32 Approx. 36% difference in ampl. For same ampl. of sinusoid. Fig2 : Magnitude of 64 point DFT of cos(  n/4).

Nov '05CS3291 : Section 836 What has happened to the ‘sincs’ function in Figure 2 ? We don’t see it because all the samples apart from one occur at the ‘zero-crossings of the ‘sincs function’. Effect of the rectangular window is no longer seen because the sampling points happen to coincide exactly with the zero- crossings of the sincs function. This always occurs when the frequency of the cosine wave coincides exactly with a frequency sampling point.

Nov '05CS3291 : Section 837 Difference between Figs 1 & 2 undesirable. Use non-rectangular windows e.g. Hann {w[n]} 0,N-1 with (Slightly different definition from the one we had for FIR filters).

Nov '05CS3291 : Section 838

Nov '05CS3291 : Section 839 In frequency-domain : (i) broader main-lobe for Hann window whose width is approx doubled as compared with rect r window (ii) reduced side-lobe levels. For sine-wave, at least 3 spectral 'bins' strongly affected even when its frequency coincides with a sampling point. Often take highest of the 3 peaks as amplitude of sine-wave. With rect r : just one bin affected when frequency of sine-wave coincides with a bin. If frequency then shifted towards next bin,  35% variation amplitude seen. With Hann: Variation of only about 15% seen. Still undesirable, but not as bad.

Nov '05CS3291 : Section 840 Reduction in amplitude estimation error for sine-waves is at expense of some loss of spectral resolution With Hann window, 3 bins strongly affected by one sine-wave We will only know that the frequency of the sine-wave lies within the range of these 3 frequencies.

Nov '05CS3291 : Section 841 DFT & FFT have many applications in DSP esp in comms. e.g. filtering by (1) performing an FFT, (2) zeroing unwanted spectral components (3) performing an inverse FFT. FFT is ‘Swiss army knife' of signal processing. Most ‘spectrum analysers’ use an FFT algorithm. Some applications of spectral estimation are: » determining frequency & loudness of a musical note, » deciding whether a signal is periodic or non-periodic, » analysing speech to recognise spoken words, » looking for sine-waves buried in noise, » measuring frequency distribution of power or energy.

Nov '05CS3291 : Section 842 Spectral analysis of 'power signals' {x[n]} These exist for all time. Extract segment {x[n]} 0,N-1 to represent {x[n]}. Energy of {x[n]} 0,N-1 is: Mean square value (MSV) of this segment is (1/N) E This is “power” of a periodic discrete time signal, of period N samples, for which a single cycle is {x[n]} 0,N-1. It may be used as an estimate of the power of {x[n]}.

Nov '05CS3291 : Section 843 Parseval's Theorem for the DFT It may be shown that for a real signal segment {x[n]} 0,N-1 : Proof

Nov '05CS3291 : Section 844 Parseval’s Theorem allows energy & power estimates to be calculated in frequency-domain instead of in time-domain. Allows us to see how power is distributed in frequency. Is there more power at high frequencies than at low frequencies or vice-versa? By Parseval's thm, estimate of power of {x[n]}, obtained by analysing {x[n]} 0,N-1, is: Usefulness of this estimate illustrated by following example.

Nov '05CS3291 : Section 845 Example: Real periodic signal {x[n]} is rect windowed to give {x[n]} 0, point DFT gives magnitude spectrum below. Estimate power of {x[n]} & comment on reliability of estimate. If {x[n]} is passed thro’ ideal digital low-pass filter with cut-off  /2 radians/sample how is power likely to be affected?

Nov '05CS3291 : Section 846 Ans: MSV of {x[n]} 0,39  power of {x[n]} = (1/1600)[2* * * *10 2 ] = 3.75 watts. Reduces to watts, i.e. by 0.8 dB Care needed to interpret such results as power estimates. For periodic or deterministic (non-random) signals: estimates from segments extracted from different parts of {x[n]} may be similar, & estimates could be fairly reliable. For random signals : may be considerable variation from estimate to estimate. Averaging may be necessary.

Nov '05CS3291 : Section 847 Power spectral density (PSD) estimate For N-point DFT,  X[k]  2 / N 2 is estimate of PSD in Watts per “bin”. A “bin” is a band-width 2  /N radians/sample centred on  k ( f S / N Hz centred on k f S / N ) Instead of |X[k]| often plot 10 log 10 (|X[k]| 2 /N 2 ) dB. against k. “PSD estimate” graph. Careful with random signals : each spectral estimate different. Can average several PSD estimates.

Nov '05CS3291 : Section 848 Spectral analysis of signals: File: OPERATOR.pcm contains sampled speech. SNR-12dB.pcm contains sine-wave corrupted with noise. Sampled at 8 kHz using 12-bit A/D converter. May be read into "MATLAB" program in Table 5 & spectrally analysed using the FFT. Meaningless to analyse a large speech file at once. Divide into blocks of 128 or 256 samples & analyse separately. Blocks of N (= 512) samples may be read in and displayed. Programs in notes available on: ~barry/mydocs/CS3291 In each case, a rectangular window is used. Exercise, modify programs to have a Hann window. Notice effectiveness of DFT in locating sine-wave in noise even when it cannot be seen in time-domain graph.