yulewalk
Recursive digital filter design
Description
[b,a] = yulewalk(n,f,m)
returns the transfer function coefficients of an nth-order IIR filter
whose frequency magnitude response approximately matches the values given in
f and m.
Examples
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)
Input Arguments
n — Filter order
positive integer scalar
Filter order, specified as a positive integer scalar.
Data Types:single | double
f — Frequency points
vector
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
of 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.
Example:[0 0.25 0.4 0.5 0.5 0.7 1] specifies an irregularly
sampled Nyquist range.
Data Types:single | double
m — Magnitude response
vector
Magnitude response, specified as a vector containing the desired responses at the
points specified in f. m must be the same
length as f.
Example:[0 1 1 1 0 0 0] specifies a bandpass magnitude
response.
Data Types:single | double
Output Arguments
b, a — Filter coefficients
row vectors
Filter coefficients, returned as row vectors. The output filter coefficients are
ordered in descending powers of z:
B(z)A(z)=b(1)+b(2)z−1+⋯+b(n+1)z−na(1)+a(2)z−1+⋯+a(n+1)z−n.
Tips
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.
Algorithms
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, yulewalk uses modified
Yule-Walker equations, with correlation coefficients computed by inverse Fourier
transformation of the specified frequency response.
To compute the numerator, yulewalk follows 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.
References
[1] 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.
Extended Capabilities
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