<< Chapter < Page Chapter >> Page >

In order to formulate a cost criterion, we must first select a model for thediscrete-time filter of interest. There are many ways of doing this, but we will usethe coefficients of a rational transfer function to model (or parameterize) the set of second order IIR filters.In this case, the elements of the vector θ = [ θ 1 , θ 2 , θ 3 , θ 4 , θ 5 ] are the coefficients of the transfer function

H θ ( z ) = θ 1 + θ 2 z - 1 + θ 3 z - 2 1 + θ 4 z - 1 + θ 5 z - 2 .

Using this parameterization, we may then define a function Cost ( θ ) which is the “cost” of using the filter H θ ( z ) .

To illustrate this numerical optimization approach, we will design a digital filter that compensates for the roll-offdue to the sample-and-hold process in an audio CD player. In lab 4, we saw that the sample-and-hold operation in a conventionalD/A converter causes the reconstructed signal to be filtered by the function

H s h ( e j ω ) = sinc ω 2 π for | ω | < π

One method of reducing this distortion is to digitally “pre-filter” a signal withthe inverse transfer function, 1 / H s h . This filter 1 / H s h pre-distorts the audio signal so the reconstructed signal has the desired frequency response.We would like to approximate the filter 1 / H s h using the second order filter of [link] .

For an audio CD player, the magnitude of the frequency response is generally considered to be more important than the phase. This isbecause we are not perceptually sensitive to phase distortion in sound. Therefore, we may choose a cost function which computes the total squarederror between the magnitudes of the desired pre-filter response, 1 / H s h ( e j ω ) , and the second order filter H θ ( e j ω ) :

Cost ( θ ) = - π π 1 H s h ( e j ω ) - H θ ( e j ω ) 2 d ω

The θ parameters that minimize this cost function will be the parameters of our designed filter.A more complex approach might also account for the filter phase, but for simplicity we will only try to match the filter magnitudes.

After the filter is designed, we may compute the difference between the CD player's frequency response in dB and the ideal desired responsein dB that the CD player should have:

Err d B ( ω ) = 20 log 10 H s h ( e j ω ) | H θ * ( e j ω ) |

where θ * is the optimized value of θ and H θ * ( e j ω ) is the optimum second-order filter.

Do the following to perform this filter design:

  • Write a Matlab function prefilter(w,theta) which computes the frequency response H θ ( e j ω ) from equation [link] for the vector of input frequencies w and the parameter vector theta .
  • Write a Matlab function Cost(theta) which computes the total squared error of equation [link] . Use a sampling interval Δ ω = 0 . 01 for the functions H θ ( e j ω ) and 1 / H s h ( e j ω ) .
  • Use the command fminsearch from Matlab's Optimization Toolbox to compute the value of the parameter θ which minimizes Cost(theta) . The function fminsearch has the syntax X = fminsearch('function_name',initial_value) where function_nameis the name of the function being minimized ( Cost ), initial_value is the starting value for the unknown parameter, and X is the minimizing parameter vector. Choose an initial value of ( θ 1 , θ 2 , θ 3 , θ 4 , θ 5 ) = ( 1 , 0 , 0 , 0 , 0 ) so that H θ ( e j ω ) = 1 .
  • Use the subplot command to plot the following three functions on the interval [ - π , π ] .
    • The desired filter magnitude response 1 / H s h ( e j ω ) .
    • The designed IIR filter magnitude response | H θ * ( e j ω ) | .
    • The error in decibels, from equation [link] .

Inlab report

Do the following:
  1. Submit the printouts of the code for the two Matlab functions prefilter.m and Cost.m .
  2. Give an analytical expression for the optimized transfer function H θ * ( z ) with the coefficients that were computed.
  3. Submit the three plots. On the error plot, mark the frequency ranges where the approximation error is high.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Purdue digital signal processing labs (ece 438). OpenStax CNX. Sep 14, 2009 Download for free at http://cnx.org/content/col10593/1.4
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Purdue digital signal processing labs (ece 438)' conversation and receive update notifications?

Ask