Frequency Response MUMT 501 Digital Audio Signal Processing

Similar documents
Frequency Response of FIR Filters

(Refer Slide Time: 01:11-01:27)

UNIVERSITY OF CALIFORNIA, SAN DIEGO Electrical & Computer Engineering Department ECE Fall 2010 Linear Systems Fundamentals

CHAPTER 6 Frequency Response, Bode Plots, and Resonance

Design of Efficient Digital Interpolation Filters for Integer Upsampling. Daniel B. Turek

Introduction to the Z-transform

SIGNAL PROCESSING & SIMULATION NEWSLETTER

Throughout this text we will be considering various classes of signals and systems, developing models for them and studying their properties.

SGN-1158 Introduction to Signal Processing Test. Solutions

3 Signals and Systems: Part II

The Z transform (3) 1

min ǫ = E{e 2 [n]}. (11.2)

TTT4110 Information and Signal Theory Solution to exam

The continuous and discrete Fourier transforms

Sampling and Interpolation. Yao Wang Polytechnic University, Brooklyn, NY11201

Auto-Tuning Using Fourier Coefficients

1.1 Discrete-Time Fourier Transform

Design of FIR Filters

TTT4120 Digital Signal Processing Suggested Solution to Exam Fall 2008

10 Discrete-Time Fourier Series

Engineering Sciences 22 Systems Summer 2004

Digital Signal Processing IIR Filter Design via Impulse Invariance

The Phase Modulator In NBFM Voice Communication Systems

UNIVERSITY OF CALIFORNIA AT BERKELEY College of Engineering Department of Electrical Engineering and Computer Sciences. EE105 Lab Experiments

CIRCUITS LABORATORY EXPERIMENT 3. AC Circuit Analysis

Discrete-Time Signals and Systems

Using the Impedance Method

Signal Detection C H A P T E R SIGNAL DETECTION AS HYPOTHESIS TESTING

Signal Processing First Lab 01: Introduction to MATLAB. 3. Learn a little about advanced programming techniques for MATLAB, i.e., vectorization.

FFT Algorithms. Chapter 6. Contents 6.1

PYKC Jan Lecture 1 Slide 1

The Calculation of G rms

Analysis/resynthesis with the short time Fourier transform

First, we show how to use known design specifications to determine filter order and 3dB cut-off

Frequency Domain and Fourier Transforms

Lab 1. The Fourier Transform

Introduction to Digital Filters

L9: Cepstral analysis

Understanding Poles and Zeros

Appendix D Digital Modulation and GMSK

B3. Short Time Fourier Transform (STFT)

HYBRID FIR-IIR FILTERS By John F. Ehlers

9 Fourier Transform Properties

The Algorithms of Speech Recognition, Programming and Simulating in MATLAB

ε: Voltage output of Signal Generator (also called the Source voltage or Applied

Clutter Filter Design for Ultrasound Color Flow Imaging

Em bedded DSP : I ntroduction to Digital Filters

Frequency Response of Filters

Controller Design in Frequency Domain

Convolution. The Delta Function and Impulse Response

Introduction to Complex Numbers in Physics/Engineering

25. AM radio receiver

G. GRAPHING FUNCTIONS

Lock - in Amplifier and Applications

UNIVERSITY OF CALIFORNIA, SAN DIEGO Electrical & Computer Engineering Department ECE Fall 2009 Linear Systems Fundamentals

2 Signals and Systems: Part I

CM0340 SOLNS. Do not turn this page over until instructed to do so by the Senior Invigilator.

Chapter 15, example problems:

Signals and Systems. Richard Baraniuk NONRETURNABLE NO REFUNDS, EXCHANGES, OR CREDIT ON ANY COURSE PACKETS

Part IB Paper 6: Information Engineering LINEAR SYSTEMS AND CONTROL Dr Glenn Vinnicombe HANDOUT 3. Stability and pole locations.

Second Order Systems

USB 3.0 CDR Model White Paper Revision 0.5

S. Boyd EE102. Lecture 1 Signals. notation and meaning. common signals. size of a signal. qualitative properties of signals.

Student Outcomes. Lesson Notes. Classwork. Discussion (10 minutes)

SR2000 FREQUENCY MONITOR

Trigonometric functions and sound

This document is downloaded from DR-NTU, Nanyang Technological University Library, Singapore.

MATHEMATICAL SURVEY AND APPLICATION OF THE CROSS-AMBIGUITY FUNCTION

AC CIRCUITS - CAPACITORS AND INDUCTORS

AVR223: Digital Filters with AVR. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Introduction to Bode Plot

SOFTWARE FOR GENERATION OF SPECTRUM COMPATIBLE TIME HISTORY

Lecture 9. Poles, Zeros & Filters (Lathi 4.10) Effects of Poles & Zeros on Frequency Response (1) Effects of Poles & Zeros on Frequency Response (3)

EE 402 RECITATION #13 REPORT

Musical Analysis and Synthesis in Matlab

Final Year Project Progress Report. Frequency-Domain Adaptive Filtering. Myles Friel. Supervisor: Dr.Edward Jones

Control System Definition

Time series analysis Matlab tutorial. Joachim Gross

Class Note for Signals and Systems. Stanley Chan University of California, San Diego

MATH 4330/5330, Fourier Analysis Section 11, The Discrete Fourier Transform

7. Beats. sin( + λ) + sin( λ) = 2 cos(λ) sin( )

Short-time FFT, Multi-taper analysis & Filtering in SPM12

Current-Transformer Phase-Shift Compensation and Calibration

chapter Introduction to Digital Signal Processing and Digital Filtering 1.1 Introduction 1.2 Historical Perspective

Digital Modulation. David Tipper. Department of Information Science and Telecommunications University of Pittsburgh. Typical Communication System

Positive Feedback and Oscillators

Experiment #11: LRC Circuit (Power Amplifier, Voltage Sensor)

Analog and Digital Signals, Time and Frequency Representation of Signals

The front end of the receiver performs the frequency translation, channel selection and amplification of the signal.

Filter Comparison. Match #1: Analog vs. Digital Filters

Electrical Resonance

Alternating-Current Circuits

Matlab GUI for WFB spectral analysis

Lecture - 4 Diode Rectifier Circuits

QAM Demodulation. Performance Conclusion. o o o o o. (Nyquist shaping, Clock & Carrier Recovery, AGC, Adaptive Equaliser) o o. Wireless Communications

L and C connected together. To be able: To analyse some basic circuits.

See Horenstein 4.3 and 4.4

San José State University Department of Electrical Engineering EE 112, Linear Systems, Spring 2010

6.025J Medical Device Design Lecture 3: Analog-to-Digital Conversion Prof. Joel L. Dawson

Transcription:

Frequency Response MUMT 501 Digital Audio Signal Processing Gerald Lemay McGill University MUMT 501 Frequency Response 1

Table of Contents I Introduction... 3 I.1 Useful Math and Systems Concepts... 3 I.2 The Plan for this Lesson... 3 II Presenting Some First Ideas About the Frequency Response, H(Ω)... 3 II.1 The System Eigenfunction: the Complex Exponential... 4 II.2 Explaining the 180 o Phase Jump... 5 III Studying the Output of a Causal System... 9 III.1 Using MATLABʼs freqz... 9 III.1.1 Phase Plot in MATLAB... 11 III.1.2 Normalized Frequency in MATLAB... 11 III.1.3 db... 11 III.2 Predicting the Amplitude from the Magnitude Plot... 13 III.3 Using this System as a Filter... 15 III.4 Use of the Word causal... 18 III.5 Relevance of Transients to Music... 18 IV Including the Transient Response... 19 References... 21 Exercises... 22 Solutions to Exercises... 23 MUMT 501 Frequency Response 2

I Introduction We begin this discussion of frequency response by reviewing some math and systems concepts. I.1 Useful Math and Systems Concepts convolution equation y[n] = x[n] h[n] = h[n]* x[n] = h[k]x[n k] all k discrete-time Fourier transform equation: H(Ω) = h[n]e jωn all n DTFT identities and properties: δ[n] 1 x[n n d ] e jωn d X(Ω) I.2 The Plan for this Lesson After reviewing some math and systems concepts, we will introduce the concept of frequency response and study the steady-state and transient response of systems. II Presenting Some First Ideas About the Frequency Response, H(Ω) Consider the following single-input single-output LTI system: x[n] h[n] y[n] MUMT 501 Frequency Response 3

We now consider a very special input for this system. We have already seen that if the input x[n] = δ[n], then the output y[n] = h[n] and we call this output the impulse response. II.1 The System Eigenfunction: the Complex Exponential Now, what if the input x[n] = e jωn? From the convolution equation, the output y[n] is given by y[n] = h[n] x[n] = h[k]x[n k] all k = h[k]e jω(n k) all k = e jωn h[k]e jωk all k = e jωn H(Ω) This input is indeed special because when x[n] = e jωn, the output is a scaled version of this input. In fact, x[n] = e jωn is an eigenfunction of the LTI system and its associated eigenvalue is H(Ω) which is the DTFT of the impulse response. H(Ω) is called the frequency response. H(Ω) is in general a complex number and we find it useful to express its magnitude and phase as functions of frequency Ω where Ω is measured in radians and where Ω is related to the frequency f in Hertz and the sampling frequency f s in samples/sec by Ω = 2π f f s. MUMT 501 Frequency Response 4

II.2 Explaining the 180 o Phase Jump Example 1. Given an impulse response h[n], determine the frequency response H(Ω), the magnitude of the frequency response H(Ω) and the phase of the frequency response H(Ω). Let h[n] = 1 ( δ[n + 1] + δ[n] + δ[n 1] ) 3. From DTFT properties and identities, H(Ω) ( ) = 1 3 e jω +1+ e jω ( ) = 1 1+ 2cosΩ 3 This frequency response is real and even as we expected since the impulse response was also real and even. Remember that for real h[n], H(Ω) will be conjugate symmetric. That is, H(Ω) = H * ( Ω) and since h[n] is also even, there is no phase shift and H(Ω) is strictly real.it is instructive to plot H(Ω) before considering the magnitude and phase. MUMT 501 Frequency Response 5

Thus, a plot of H(Ω) = 1 ( 1+ 2cosΩ) vs Ω produces 3 Note that the zero-crossing occurs at Ω = 2.094 = 2.094 180o π = 120o. We conclude that there will be an an additional phase shift of 1 180 o at Ω = 120 o. MUMT 501 Frequency Response 6

Now, we plot the magnitude of the frequency response. That is, we plot H (Ω) = 1 (1+ 2cosΩ) 3 Because we are plotting absolute values, do you see how the response curve gets flipped after Ω = 120 o? MUMT 501 Frequency Response 7

If we plot the phase, we obtain MUMT 501 Frequency Response 8

III Studying the Output of a Causal System In the previous example, our system was non-causal. If we delay this impulse response by one sample, we can produce a version which will be causal. That is, h 1 [n] = h[n 1] = 1 (δ[n]+δ[n 1]+δ[n 2]) 3 whose frequency response is given by H 1 (Ω) = e jω H(Ω) = 1 ( 1+ 2cos(Ω) )e jω 3 Note that the magnitude is the same as in example 1 but that the phase is now Ω with an additional phase of 180 o at Ω = 120 o. III.1 Using MATLABʼs freqz An effective way to plot the magnitude and phase for a causal LTI system is to use the MATLAB command freqz. That is, freqz([1 1 1]/3,1) whose arguments will be clearer when we discuss the Z-transform. MUMT 501 Frequency Response 9

MUMT 501 Frequency Response 10

III.1.1 Phase Plot in MATLAB Letʼs talk about the phase plot first. Notice that the phase is linear. Ideally, the phase would be zero for a system but linear phase is the next best thing. Just before the frequency of Ω = 120 o, the phase is 120 o, and just after Ω = 120 o, the phase has an additional 180 o to give us 120 o +180 o = 60 o. III.1.2 Normalized Frequency in MATLAB Now, the frequency axis for both plots is in normalized frequency where 1 corresponds to Ω = π = 180 o. Do you see that Ω = 120 o corresponds to 120o o = 0.67 in normalized frequency. To convert from normalized frequency to frequency in 180 radians, just multiply by π. III.1.3 db Now, letʼs talk about the magnitude. The plot is in db which is the symbol for decibel. To convert to db, take 20log 10 ( H(Ω) ) For example, at Ω = 0.5098 π, the magnitude in db is given by 1 20log 10 ( 1+ 2cos(0.5098π )) = 10.09 which agrees with the MATLAB plot 3 MUMT 501 Frequency Response 11

MUMT 501 Frequency Response 12

III.2 Predicting the Amplitude from the Magnitude Plot If we use as input, a sinusoid whose frequency is Ω = π 3 = 1.047 with amplitude 2, we see that the magnitude of the frequency response at that frequency is H(Ω) = 1 3 1+ 2cos(60o ) = 2 3 On our magnitude plot, MUMT 501 Frequency Response 13

Thus, our output amplitude will be 2 H(Ω) = (2) 2 3 = 4 which agrees with our output plot. 3 MUMT 501 Frequency Response 14

We could predict the amplitude and phase of the output of a sinusoid for a given frequency from knowledge of the amplitude of the input sinusoid and the magnitude of the frequency response. Note that the output sinusoid compared to the input sinusoid, has the same frequency (itʼs a linear system), has a phase shift of one sample (one sample shift from the symmetric version), and that the predicted amplitude of 4/3 does not occur immediately. In fact, at n = 2 it appears that our output sinusoid has an amplitude of 1. We will return to this later when we talk about transient responses. III.3 Using this System as a Filter When we look at the magnitude plot, we see that an input signal of frequency corresponding to Ω = 120 o will have an output of zero. Letʼs construct such a signal. Let x[n] = 2cos 2π 3 n u[n] and use the MATLAB command filter to obtain the output y[n]. Hereʼs the MATLAB: L = 10; n = 0:L; x = 2*cos((2*pi/3)*n); stem(n,filter([1 1 1]/3,1,x)) set(gca,'ylim',[-2.2 2.2],'Ygrid','on') title('output y[n]') Here are the input and output sequences. MUMT 501 Frequency Response 15

MUMT 501 Frequency Response 16

Notice that the output is indeed zero but only after the third sample. We tell you why right away and then go into more detail in the next section. MUMT 501 Frequency Response 17

The why: the frequency response relates to the steady-state output. It assumes that the input signal is present for alltimes. Remember that we derived the frequency response by considering an input x[n] = e jωn and not for an input that started at n = 0 that is x[n] = e jωn u[n]. We will see in the next section that for a causal input, the output y[n] is actually comprised of two parts: a steady-state portion y ss [n] and a transient portion y tr [n]. In fact, y[n] = y ss [n]+ y tr [n]. III.4 Use of the Word causal We slipped in the word causal to describe a signal, causal input, when technically, causality deals with systems and not with signals. So whatʼs up? Well, a system is causal if its impulse response h[n] is zero for n < 0. We borrow this idea to say that a signal which is zero for n < 0, is a causal signal. III.5 Relevance of Transients to Music The relevance to music, is that the beginning of a musical sound gives us auditory cues that help us identify which instrument is being played. If you omit the beginning sound, it is difficult to discriminate between a trumpet and a violin. The beginning sound is a signal referred to as the onset transient, sometimes called the attack, and is the sum of the steady-state response and the transient response. The sustain portion is essentially the steady-state response and occurs after the transient response has decayed to zero. The transient response will decay to zero for finite-impulse response (FIR) systems and for stable infinite-impulse response (IIR) systems. MUMT 501 Frequency Response 18

IV Including the Transient Response This section is adapted from ([Oppenheim, 1998], p. 46) To study the transient response y tr [n], we let the input start at time n = 0. That is, let x[n] = e jωn u[n] and calculate the output y[n] using convolution. y[n] = h[n] x[n] = h[k]x[n k] all k = h[k]e jω(n k) u[n k] all k = e jωn h[k]e jωk u[n k] all k Now, we see how that delayed unit step impacts the summation. u[n k] = 0, k > n 1, k n from the fact that the unit step being equal to one when its argument is greater than or equal to zero, we arrive at a value for one of the limits in the summation, i.e, n k 0 k n This gives us the upper limit for the summation. If we assume that the LTI system is causal, then h[k] = 0 for k < 0. This gives us the lower limit for the summation. Thus, our expression for y[n] becomes MUMT 501 Frequency Response 19

y[n] = e jωn n k =0 h[k]e jωk. This closely resembles our result for the steady-state response given by the frequency response but it includes additional information about the transient response. To see this, write our previous result as y[n] = e jωn n h[k]e jωk k =0 = e jωn h[k]e jωk h[k]e jωk k =0 k =n+1 We recognize the first summation as the frequency response H(Ω). Thus, y[n] = e jωn H (Ω) e jωn h[k]e jωk k =n+1 and we identify the first term as the steady-state response y ss [n] and the second term as the transient response y tr [n]. Thus, y[n] = y ss [n]+ y tr [n] and y tr [n] = e jωn h[k]e jωk. k =n+1 We will explore the computation of the transient response when the input is a causal sinusoid in one of the assignment problems. MUMT 501 Frequency Response 20

References [Depalle, 2008] Course notes from MUMT 501, Digital Audio Signal Processing, taught by Professor Phlippe Depalle, Fall 2008. [Oppenheim, 1998] Discrete-Time Signal Processing, 2 nd edition, Alan V. Oppenheim, Ronald W. Schafer, and John R. Buck, Prentice-Hall, 1998. [Meine, 2002] Fast Sinusoid Synthesis for MPEG-4 HILN Parametric Audio Decoding, Nikolaus Meine and Heiko Purnhagen, Proc. of the 5th Int. Conference on Digital Audio Effects (DAFx-02), Hamburg, Germany, September 26-28, 2002. MUMT 501 Frequency Response 21

Exercises Exercise 1. We use sinusoids frequently in signal processing. Hereʼs a clever use of discrete-time systems to generate a sinusoid. Use MATLAB to implement the fast sinusoid algorithm [Meine, 2002], [Depalle, 2008] x[0] = Acos(ϕ o ) x[1] = Acos(ω o +ϕ o ) x[n] = 2cos(ω o )x[n 1] x[n 2], for n = 2,3,...,N 1 Exercise 2. Determine the frequency response H(Ω) for h[n] = 1 4 MATLABʼs freqz command. Relate these results to your analytic expression for H(Ω). 3 k=0 δ[n k]. Plot the magnitude and phase using MUMT 501 Frequency Response 22

Solutions to Exercises Solution to Exercise 1. Use MATLAB to implement the fast sinusoid algorithm. The normalized frequency F o is expressed as F o = f F s where the sampling frequency F s = 44100 samples/sec. From x[n] = Acos(2πF o n +ϕ), x[n 1] = Acos(2πF o (n 1) +ϕ) = Acos(2πF o n +ϕ 2πF o ) = Acos(2πF o n +ϕ)cos(2πf o ) + Asin(2πF o n +ϕ)sin(2πf o ) x[n 2] = Acos(2πF o (n 1) +ϕ)cos(2πf o ) + Asin(2πF o (n 1) +ϕ)sin(2πf o ) Also, from x[n] = Acos(2πF o n +ϕ), we can write x[n] = Acos(2πF o n +ϕ) = Acos(2πF o (n 1) + 2πF o +ϕ) = Acos(2πF o (n 1) +ϕ + 2πF o ) = Acos(2πF o (n 1) +ϕ)cos(2πf o ) Asin(2πF o (n 1) +ϕ)sin(2πf o ) MUMT 501 Frequency Response 23

Thus, x[n]+ x[n 2] = 2Acos(2πF o (n 1) +ϕ)cos(2πf o ) = 2cos(2πF o )Acos(2πF o (n 1) +ϕ) = 2cos(2πF o )x[n 1] That is, x[n] = Cx[n 1] x[n 2], where the constant C = 2cos(2πF o ). Note that the constant is calculated once outside the loop and that the constant has a value uniquely determined by the frequency specification. Thus, the amplitude and phase information are contained in the two initial conditions. % FastSinusoid.m Fs = 44100.; f = 440.; Fo = f/fs; %normalized frequency dur = 1; %[sec] phi = -pi/2; A = 1.; N = round(dur*fs); x = zeros(n,1); x(1) = A*cos(phi); x(2) = A*cos(2*pi*Fo + phi); MUMT 501 Frequency Response 24

C = 2*cos(2*pi*Fo); for index=3:n x(index) = C*x(index-1) - x(index-2); end t=linspace(0,1,fs); plot(t(1:400),x(1:400)) title('fast Sinusoid') set(gca,'xgrid','on') set(gca,'ylim',[-1.2 1.2],'Ygrid','on') %pause X = fft(x); plot([0:999],abs(x(1:1000))) title('magnitude spectrum for f = 440 Hz fast sinusoid') %sound(x,fs) MUMT 501 Frequency Response 25

1/(.005102-.002835) ans = 441.1116 Why is this value not equal to 440? MUMT 501 Frequency Response 26

Why is the value in the following plot at exactly 440 (implying no numerical imprecision)? MUMT 501 Frequency Response 27

Solution to Exercise 2. Determine the frequency response H(Ω) for h[n] = 1 4 using MATLABʼs freqz command. Relate these results to your analytic expression for H(Ω). Using the result that 3 k=0 δ[n k]. Plot the magnitude and phase 1 sin[ω(m +1) / 2] H(Ω) = e jωm /2 from ([Oppenheim, 1998], p. 62 for h[n] = M +1 sin(ω / 2) we obtain H(Ω) = 1 4 sin2ω j3ω/2 e sin(ω / 2) 1 M +1, for 0 n M 0, otherwise for M = 3 The MATLAB command is freqz([1 1 1 1]/4,1) and produces the following magnitude and phase plots MUMT 501 Frequency Response 28

MUMT 501 Frequency Response 29

The analytic expression for the magnitude of H(Ω) is H(Ω) = 1 4 20log 10 (1) = 0 which agrees with the magnitude plot. sin(2ω) sin(ω / 2). As Ω 0, H(Ω) 1 2Ω 4 Ω / 2 = 1 and For values of the argument of sin equal to π, we have the first zero crossing. That is, 2Ω = π Ω = π 2 which in normalized frequency is 1 = 0.5 which agrees with the magnitude plot. There is another zero at 2Ω = 2π Ω = π which 2 also agrees with the plot. There is an additional 180 o of phase at Ω = π 2 where the phase just before this value of Ω is 3Ω 2 = 3(π / 2) 2 = 3π 4 = 135o. MUMT 501 Frequency Response 30