Recursive digital filter design
Yule-Walker Design of Lowpass Filter
Design an 8th-order lowpass filter with normalized cutoff frequency 0.6. Plot its frequency response and overlay the response of the corresponding ideal filter.
f = [0 0.6 0.6 1]; m = [1 1 0 0]; [b,a] = yulewalk(8,f,m); [h,w] = freqz(b,a,128); plot(w/pi,mag2db(abs(h))) yl = ylim; hold on plot(f(2:3),yl,'--') xlabel('\omega/\pi') ylabel('Magnitude') grid
Increase the stopband attenuation by specifying a wider transition band.
f = [0 0.55 0.6 0.65 1]; m = [1 1 0.5 0 0]; [b,a] = yulewalk(8,f,m); h = freqz(b,a,128); hold on plot(w/pi,mag2db(abs(h))) hold off ylim(yl)
n — Filter order
positive integer scalar
Filter order, specified as a positive integer scalar.
f — Frequency points
Frequency points, specified as a vector of points in the range between 0 and 1,
where 1 corresponds to the Nyquist frequency, or half the sample rate. The first point
f must be 0 and the last point 1. All intermediate points must
be in increasing order.
f can have duplicate frequency points
corresponding to steps in the frequency response.
[0 0.25 0.4 0.5 0.5 0.7 1] specifies an irregularly
sampled Nyquist range.
m — Magnitude response
Magnitude response, specified as a vector containing the desired responses at the
points specified in
m must be the same
[0 1 1 1 0 0 0] specifies a bandpass magnitude
a — Filter coefficients
Filter coefficients, returned as row vectors. The output filter coefficients are ordered in descending powers of z:
When specifying the frequency response, avoid excessively sharp transitions from passband to stopband. You may need to experiment with the slope of the transition region to get the best filter design.
yulewalk designs recursive IIR digital filters using a least-squares
fit to a specified frequency response. The function performs the fit in the time domain.
To compute the denominator coefficients,
yulewalkuses modified Yule-Walker equations, with correlation coefficients computed by inverse Fourier transformation of the specified frequency response.
To compute the numerator,
yulewalkfollows these steps:
Compute a numerator polynomial corresponding to an additive decomposition of the power frequency response.
Evaluate the complete frequency response corresponding to the numerator and denominator polynomials.
Use a spectral factorization technique to obtain the impulse response of the filter.
Obtain the numerator polynomial by a least-squares fit to this impulse response.
 Friedlander, B., and Boaz Porat. "The Modified Yule-Walker Method of ARMA Spectral Estimation." IEEE® Transactions on Aerospace Electronic Systems. Vol. AES-20, Number 2, 1984, pp. 158–173.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
If specified, the order of recursion must be a constant. Expressions or variables are allowed if their values do not change.
Introduced before R2006a