DCSP-10: DFT and PSD. Jianfeng Feng. Department of Computer Science Warwick Univ., UK

Similar documents
Biomedical Signals. Signals and Images in Medicine Dr Nabeel Anwar

Discrete Fourier Transform (DFT)

EE 451: Digital Signal Processing

From Fourier Series to Analysis of Non-stationary Signals - VII

LABORATORY - FREQUENCY ANALYSIS OF DISCRETE-TIME SIGNALS

EE 451: Digital Signal Processing

Fourier Methods of Spectral Estimation

EE 464 Short-Time Fourier Transform Fall and Spectrogram. Many signals of importance have spectral content that

URBANA-CHAMPAIGN. CS 498PS Audio Computing Lab. Audio DSP basics. Paris Smaragdis. paris.cs.illinois.

EE 215 Semester Project SPECTRAL ANALYSIS USING FOURIER TRANSFORM

Digital Signal Processing PW1 Signals, Correlation functions and Spectra

THE CITADEL THE MILITARY COLLEGE OF SOUTH CAROLINA. Department of Electrical and Computer Engineering. ELEC 423 Digital Signal Processing

Topic 2. Signal Processing Review. (Some slides are adapted from Bryan Pardo s course slides on Machine Perception of Music)

Outline. Introduction to Biosignal Processing. Overview of Signals. Measurement Systems. -Filtering -Acquisition Systems (Quantisation and Sampling)

Signal segmentation and waveform characterization. Biosignal processing, S Autumn 2012

EE123 Digital Signal Processing

Frequency Domain Representation of Signals

Digital Signal Processing

Digital Signal Processing Fourier Analysis of Continuous-Time Signals with the Discrete Fourier Transform

Time Series/Data Processing and Analysis (MATH 587/GEOP 505)

Project 0: Part 2 A second hands-on lab on Speech Processing Frequency-domain processing

Topic 6. The Digital Fourier Transform. (Based, in part, on The Scientist and Engineer's Guide to Digital Signal Processing by Steven Smith)

Figure 1: Block diagram of Digital signal processing

Signal Processing Toolbox

Lab 8. Signal Analysis Using Matlab Simulink

ELT COMMUNICATION THEORY

Armstrong Atlantic State University Engineering Studies MATLAB Marina Sound Processing Primer

B.Tech III Year II Semester (R13) Regular & Supplementary Examinations May/June 2017 DIGITAL SIGNAL PROCESSING (Common to ECE and EIE)

DCSP-3: Minimal Length Coding. Jianfeng Feng

6.02 Practice Problems: Modulation & Demodulation

ELECTRONOTES APPLICATION NOTE NO Hanshaw Road Ithaca, NY Nov 7, 2014 MORE CONCERNING NON-FLAT RANDOM FFT

ME scope Application Note 01 The FFT, Leakage, and Windowing

Sampling and Reconstruction of Analog Signals

Speech Signal Analysis

Digital Filters IIR (& Their Corresponding Analog Filters) Week Date Lecture Title

Design of FIR Filter for Efficient Utilization of Speech Signal Akanksha. Raj 1 Arshiyanaz. Khateeb 2 Fakrunnisa.Balaganur 3

Time-Frequency analysis of biophysical time series. Courtesy of Arnaud Delorme

JOURNAL OF OBJECT TECHNOLOGY

DFT: Discrete Fourier Transform & Linear Signal Processing

Chapter 7. Frequency-Domain Representations 语音信号的频域表征

Digital Signal Processing

ADSP ADSP ADSP ADSP. Advanced Digital Signal Processing (18-792) Spring Fall Semester, Department of Electrical and Computer Engineering

Laboratory Assignment 4. Fourier Sound Synthesis

Lecture 7 Frequency Modulation

DSP First. Laboratory Exercise #11. Extracting Frequencies of Musical Tones

Multirate Digital Signal Processing

Use Matlab Function pwelch to Find Power Spectral Density or Do It Yourself

Problem Set 1 (Solutions are due Mon )

It is the speed and discrete nature of the FFT that allows us to analyze a signal's spectrum with MATLAB.

(i) Understanding the basic concepts of signal modeling, correlation, maximum likelihood estimation, least squares and iterative numerical methods

Time-Frequency analysis of biophysical time series

Signal Processing. Naureen Ghani. December 9, 2017

SAMPLING THEORY. Representing continuous signals with discrete numbers

CS3291: Digital Signal Processing

Jawaharlal Nehru Engineering College

Signal Processing First Lab 20: Extracting Frequencies of Musical Tones

Filter Banks I. Prof. Dr. Gerald Schuller. Fraunhofer IDMT & Ilmenau University of Technology Ilmenau, Germany. Fraunhofer IDMT

Lecture 3 Complex Exponential Signals

ECE 201: Introduction to Signal Analysis

FFT analysis in practice

Limitations of Sum-of-Sinusoid Signals

DISCRETE FOURIER TRANSFORM AND FILTER DESIGN

Signal Processing. Introduction

ECEGR Lab #8: Introduction to Simulink

Contents. Introduction 1 1 Suggested Reading 2 2 Equipment and Software Tools 2 3 Experiment 2

Laboration Exercises in Digital Signal Processing

Fourier Series. Discrete time DTFS. (Periodic signals) Continuous time. Same as one-period of discrete Fourier series

Lecture 3, Multirate Signal Processing

Fourier Transform. Prepared by :Eng. Abdo Z Salah

Spectral Estimation & Examples of Signal Analysis

Notes on Fourier transforms

Signal Analysis. Young Won Lim 2/9/18

Chapter 4 SPEECH ENHANCEMENT

Design of FIR Filters

EXPERIMENT 4 INTRODUCTION TO AMPLITUDE MODULATION SUBMITTED BY

L A B 3 : G E N E R A T I N G S I N U S O I D S

Sampling of Continuous-Time Signals. Reference chapter 4 in Oppenheim and Schafer.

Short-Time Fourier Transform and Its Inverse

Signal Analysis. Young Won Lim 2/10/18

Wireless Communication Systems Laboratory Lab#1: An introduction to basic digital baseband communication through MATLAB simulation Objective

Noise estimation and power spectrum analysis using different window techniques

PROBLEM SET 5. Reminder: Quiz 1will be on March 6, during the regular class hour. Details to follow. z = e jω h[n] H(e jω ) H(z) DTFT.

ENGR 210 Lab 12: Sampling and Aliasing

A Brief Introduction to the Discrete Fourier Transform and the Evaluation of System Transfer Functions

Chapter 2. Signals and Spectra

Short Time Fourier Transform *

1. In the command window, type "help conv" and press [enter]. Read the information displayed.

Reading: Johnson Ch , Ch.5.5 (today); Liljencrants & Lindblom; Stevens (Tues) reminder: no class on Thursday.

Digital Signal Processing ETI

PYKC 27 Feb 2017 EA2.3 Electronics 2 Lecture PYKC 27 Feb 2017 EA2.3 Electronics 2 Lecture 11-2

6.S02 MRI Lab Acquire MR signals. 2.1 Free Induction decay (FID)

Lab P-4: AM and FM Sinusoidal Signals. We have spent a lot of time learning about the properties of sinusoidal waveforms of the form: ) X

CHAPTER 4 IMPLEMENTATION OF ADALINE IN MATLAB

Sampling and Reconstruction

Digital Filters FIR and IIR Systems

Topic. Spectrogram Chromagram Cesptrogram. Bryan Pardo, 2008, Northwestern University EECS 352: Machine Perception of Music and Audio

5650 chapter4. November 6, 2015

Concordia University. Discrete-Time Signal Processing. Lab Manual (ELEC442) Dr. Wei-Ping Zhu

Moving from continuous- to discrete-time

Experiment 1 Introduction to MATLAB and Simulink

Transcription:

DCSP-10: DFT and PSD Jianfeng Feng Department of Computer Science Warwick Univ., UK Jianfeng.feng@warwick.ac.uk http://www.dcs.warwick.ac.uk/~feng/dcsp.html

DFT Definition: The discrete Fourier transform (DFT) and its own inverse DFT (IDFT) associated with a vector X = ( X[0], X[1],, X[N-1] ) to a vector x = ( x[0], x[1],, x[n-1] ) of N data points, is given by ) N 1 " X[k] = DFT{x[n]} = x[n]exp$ j 2πk # N n % + ' & n=0 + * + x[n] = IDFT{X[k]} = 1 N 1 + " X[k]exp$ j 2πk N # N n % ', + & k=0

Example Let (x[0], x[1], x[2], x[3]) = (1 2-1 -1) be a data vector of length N=4. Work out its DFT (X[0], X[1], X[2], X[3]) X[k] = 3 n=0 x[n]exp( j 2πk N n) X[0] =1+ 2 1 1=1 X[1] = 3 n=0 x[n]exp( j 2π1 4 n) = exp( j 2π1 4 =1+ 2exp( j π 2 ) exp( j π 2 2) exp( j π 2 3) 0)+ 2exp( j 2π1 4 2π1 1) 1exp( j 4 2) 12exp( j 2π1 4 3) =1+ 2exp( j π 2 ) [exp( j π 2 )]2 [exp( j π 2 )]3 =1+ 2( j) ( j) 2 ( j) 3 =1 2 j +1 j = 2 3j X[2] = 3 n=0 x[n]exp( j 2π 2 4 n) =1+ 2( j)2 (( j) 2 ) 2 (( j) 3 ) 2 =1 2 1+1= 1 X[3] = 3 n=0 x[n]exp( j 2π 3 4 n) =1+ 2( j)3 (( j) 2 ) 3 (( j) 3 ) 3 =1+ 2 j +1+ j = 2 + 3j

Example x [n] X [ k ] 2+3j α -α 2-3j [1 2-1 -1] Time domain [ 1 2+3 j -1 2-3 j ] Complex plane

Example x [n] X [ k ] 2+3j α -α 2-3j Time domain Complex plane

Example Complex plane (polar coordinate) x [n] Amplitude 13 1 phase α -α Time domain Frequency domain

Matlab demo x=[1 2-1 -1]; X=fft(x) X = 1.0000 + 0.0000i 2.0000-3.0000i -1.0000 + 0.0000i 2.0000 + 3.0000i ifft(x) ans = 1 2-1 -1

Recap FT [ integral (x*exp) ] Discretion DTFT [ sum (x*exp) ] Truncation DFT [multiplication of two matrices]

FFT: Fast Fourier Transform DFT is the basis of a number of applications. One of the most important tools in digital signal processing. The problem is that a brute-force implementation would hardly be feasible in real time (even for a data set of modest length).

FFT: Fast Fourier Transform DFT can be computed in a very efficient way, exploiting the very structure of the algorithm. For a data set of length N, the complexity of the FFT grows as N log N DFT computed by brute force grow as N 2. FFT is widely used in many applications.

Applications cover some today and more next week Essentially, the remain of the module is its application Frequency eye

I. DFT for spectral estimation One of the uses is to estimate the frequency spectrum of a signal. The Fourier transform produces a spectrum from which the original function can be reconstructed by an inverse transform. In order to do that, it preserves not only the magnitude of each frequency component, but also its phase. represented as a 2-dimensional vector or a complex number, or as magnitude and phase (polar coordinates). In graphical representations, often only the magnitude (or squared magnitude) component is shown. Referred to as a power spectrum Density (PSD)

Frequency domain (amplitude only) Locating tones close all N=10; %sampling rate N Hz T=10; % time d1=1; % first period d2=3 % second period for i=1:t*n t(i)=i/n; x(i)=cos(d1*2*pi*i/n)+cos(d2*2*pi*i/n); end figure(1) plot(t,x) figure(2) plot(t*n/(t),abs(fft(x))) xlim([0 N/2]); xlabel('hz') Time domain (sec) Fig. 1

Understanding the plot Sampling rate is F s, the largest (fastest) frequency from the data is then F s /2 Remembering that our frequency domain is in [0 2π] which matches to [0 F s ] Divide [0 F s ] into N intervals and plot abs X(K) against K which gives power against F s Since it is symmetric, we sometime only plot out [0, F s/ /2] Here F s =1 0 Hz

Mysterious sound Fig. 2 clear all close all sampling_rate=100;%hz omega=30; %signal frequecy Hz N=20000; %total number of samples for i=1:n x_sound(i)=cos(2*pi*omega*i/sampling_rate); %sign x(i)=x_sound(i)+2*randn(1,1); %signal+noise axis(i)=sampling_rate*i/n; % for psd time(i)=i/sampling_rate; % for time trace end subplot(1,2,1) plot(time,x); %signal + noise, time trace xlabel('second') ylabel('x') subplot(1,2,2) plot(axis,abs(fft(x)),'r'); % magnitude of signal xlabel('hz'); ylabel('amplitude') sound(x_sound) Simple Matlab program is left on slides

Issues on Signals Use this signal {x[0],, x[n-1]} FFT

Issues on Signals Use this signal Use this signal {x[0],, x[n-1]} {x[0],, x[2n-1]} FFT FFT

Issues on Signals Use this signal Use this signal FFT {x[0],, x[8n-1]} FFT {x[0],, x[3n-1]}

Issues on Signals Use this signal Use this signal FFT With the increased signal length The power increases We can locate the signal more precisely FFT

Issues on noise Two sets of random noise (100 points each, upper panel) Power Spectrum (bottom panel) Make sense?

Issues on noise When N is large abs (DFT ( {x[n], n=0,, N-1} ) ) à DFT ( {γ [n] } ) where γ [n] is the auto-correlation function (ACF) Remember that the ACF of white noise is X[k] = δ[n]exp( 2πk N 2πk jn) = exp( N j0) =1

Issues on noise When N is large abs (DFT ( {x[n], n=0,, N-1} ) ) à DFT ( {γ [n] } ) where γ [n] is the auto-correlation function (ACF) Remember that the ACF of white noise is X[k] = δ[n]exp( 2πk N 2πk jn) = exp( N j0) =1 Powers are equally distributed at each frequency Hence the name of white noise Colour noise: not equally distributed (ACF is not delta)

Issues on noise light goes a through a prism White lightwhite passes prism Remember that the ACF of white noise is X[k] = δ[n]exp( 2π k 2π k jn) = exp( j0) =1 N N Powers are equally distributed at each frequency Hence the name of white noise Colour noise: not equally distributed (ACF is not delta)

Coming back to Mysterious sound clear all close all sampling_rate=100;%hz omega=30; %signal frequecy Hz N=20000; %total number of samples for i=1:n x_sound(i)=cos(2*pi*omega*i/sampling_rate); %signal x(i)=x_sound(i)+2*randn(1,1); %signal+noise axis(i)=sampling_rate*i/n; % for psd time(i)=i/sampling_rate; % for time trace end subplot(1,2,1) plot(time,x); %signal + noise, time trace xlabel('second') ylabel('x') Fig. 2 subplot(1,2,2) plot(axis,abs(fft(x)),'r'); % magnitude of signal xlabel('hz'); ylabel('amplitude') sound(x_sound) noise

Coming back to Mysterious sound clear all close all sampling_rate=100;%hz omega=30; %signal frequecy Hz N=20000; %total number of samples for i=1:n x_sound(i)=cos(2*pi*omega*i/sampling_rate); %signal x(i)=x_sound(i)+2*randn(1,1); %signal+noise axis(i)=sampling_rate*i/n; % for psd time(i)=i/sampling_rate; % for time trace end subplot(1,2,1) plot(time,x); %signal + noise, time trace xlabel('second') ylabel('x') Fig. 2 subplot(1,2,2) plot(axis,abs(fft(x)),'r'); % magnitude of signal xlabel('hz'); ylabel('amplitude') sound(x_sound) signal noise

Matlab A few words on Matlab periodogram pwelch Fs = 1000; t = 0:1/Fs:.3; % Fs is the sampling rate x = cos(2*pi*t*200)+randn(size(t)); % A cosine of 200Hz plus noise periodogram(x,[],'twosided',512,fs); % The default window is used Fs = 1000; t = 0:1/Fs:.296; %Fs is the sampling rate x = cos(2*pi*t*200)+randn(size(t)); % A cosine of 200Hz plus noise pwelch(x,[],[],[],fs,'twosided'); % Uses default window, overlap & NFFT. It is essentially fft It is slightly advanced

Matlab A few words on Matlab periodogram pwelch Fs = 1000; t = 0:1/Fs:.3; % Fs is the sampling rate x = cos(2*pi*t*200)+randn(size(t)); % A cosine of 200Hz plus noise periodogram(x,[],'twosided',512,fs); % The default window is used Fs = 1000; t = 0:1/Fs:.296; %Fs is the sampling rate x = cos(2*pi*t*200)+randn(size(t)); % A cosine of 200Hz plus noise pwelch(x,[],[],[],fs,'twosided'); % Uses default window, overlap & NFFT. Abs(fft(x)) It is essentially fft It is slightly advanced

Matlab A few words on Matlab periodogram Fs = 1000; t = 0:1/Fs:.3; % Fs is the sampling rate x = cos(2*pi*t*200)+randn(size(t)); % A cosine of 200Hz plus noise periodogram(x,[],'twosided',512,fs); % The default window is used pwelch Fs = 1000; t = 0:1/Fs:.296; %Fs is the sampling rate x = cos(2*pi*t*200)+randn(size(t)); % A cosine of 200Hz plus noise pwelch(x,[],[],[],fs,'twosided'); % Uses default window, overlap & NFFT. Abs(fft(x)) In Welch, essentially the signals are divided into many segments For each segments, an FFT is carried The summation of FFT is plotted and hence the noise is averaged out It is essentially fft It is slightly advanced

Spectrogram In real life examples, all signals change with time (music for example)

Spectrogram In real life example, all signals change with time (music for example) Using sliding window to sample signals and calculate PSD

Spectrogram In real life example, all signals change with time (music for example) Using sliding window to sample signals and calculate PSD

Spectrogram In real life example, all signals change with time (music for example) Using sliding windows to sample signals and calculate PSD

Spectrogram It is called STFT (short time Fourier transform) The obtained results are plotted using colour map as in the next figure: spectrogram

Spectrogram F r e q u e n c y 3 Hz 1 Hz Time (sec)

Example I t=0:0.001:2; % 2 secs @ 1kHz sample rate y=chirp(t,100,1,200,'q'); % Start @ 100Hz, cross 200Hz at t=1sec spectrogram(y, 128,120,128,1E3); % Display the spectrogram title('quadratic Chirp: start at 100Hz and cross 200Hz at t=1sec'); sound(y) y=chirp(t,100,1,200,'q'); % Start @ Fs=5000; filename = 'h.wav'; audiowrite(filename,y,fs); F r e q u e n c y Time (sec)

Example II t=0:0.001:20; % 2 secs @ 1kHz sample rate y=chirp(t,100,1,200,'q'); % Start @ 100Hz, cross 200Hz at t=1sec spectrogram(y,128,120,128,1e3); % Display the spectrogram title('quadratic Chirp: start at 100Hz and cross 200Hz at t=1sec'); Fs=6000; filename='h.wav'; audiowrite(filename,y,fs); F r e q u e n c y ); sound(y) Time (sec)

Spectrogram: real life example

Summary DFT Power Spectrum Density Spectrogram

Next week Image processing + sampling theorem Filter