You are here : matlabSignal Processingyulewalk

# yulewalk() - Signal Processing

yulewalk designs recursive IIR digital filters
using a least-squares fit to a specified frequency response.[b,a] = yulewalk(n,f,m) returns
row vectors, b and a, containing
the n+1 coefficients of the order n IIR
filter whose frequency-magnitude characteristics approximately match
those given in vectors f and m:f is a vector of frequency points,
specified in the range between 0 and 1, where 1 corresponds to half
the sample frequency (the Nyquist frequency). The first point of f must
be 0 and the last point 1. All intermediate points must be in increasing
order. Duplicate frequency points are allowed, corresponding to steps
in the frequency response.m is a vector containing the desired
magnitude response at the points specified in f.f and m must
be the same length.plot(f,m) displays the filter shape.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−nWhen 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.

### Syntax

[b,a] = yulewalk(n,f,m)

### Example

Yule-Walker Design of Lowpass FilterOpen This Example
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,abs(h),f,m,'--')
xlabel 'Radian frequency (\omega/\pi)', ylabel Magnitude
legend('Yule-Walker','Ideal'), legend boxoff