Main Content


Determine whether filter has linear phase


flag = islinphase(b,a)
flag = islinphase(sos)
flag = islinphase(d)
flag = islinphase(...,tol)


flag = islinphase(b,a) returns a logical output, flag, equal to true if the filter coefficients in b and a define a linear phase filter. flag is equal to false if the filter does not have linear phase.

flag = islinphase(sos) returns true if the filter specified by second order sections matrix, sos, has linear phase. sos is a K-by-6 matrix, where the number of sections, K, must be greater than or equal to 2. Each row of sos corresponds to the coefficients of a second order (biquad) filter. The ith row of the sos matrix corresponds to [bi(1) bi(2) bi(3) ai(1) ai(2) ai(3)].

flag = islinphase(d) returns true if the digital filter, d, has linear phase. Use designfilt to generate d based on frequency-response specifications.

flag = islinphase(...,tol) uses the tolerance, tol, to determine when two numbers are close enough to be considered equal. If not specified, tol, defaults to eps^(2/3).


collapse all

Use the window method to design a tenth-order lowpass FIR filter with normalized cutoff frequency 0.55. Verify that the filter has linear phase.

d = designfilt('lowpassfir','DesignMethod','window', ...
flag = islinphase(d)
flag = logical

[phs,w] = phasez(d);

xlabel('Frequency \omega/\pi')

IIR filters in general do not have linear phase. Verify the statement by constructing eighth-order Butterworth, Chebyshev, and elliptic filters with similar specifications.

ord = 8;
Wcut = 0.35;
atten = 20;
rippl = 1;

[zb,pb,kb] = butter(ord,Wcut);
sosb = zp2sos(zb,pb,kb);

[zc,pc,kc] = cheby1(ord,rippl,Wcut);
sosc = zp2sos(zc,pc,kc);

[zd,pd,kd] = cheby2(ord,atten,Wcut);
sosd = zp2sos(zd,pd,kd);

[ze,pe,ke] = ellip(ord,rippl,atten,Wcut);
sose = zp2sos(ze,pe,ke);

Plot the phase responses of the filters. Determine whether they have linear phase.

hold on
hold off
ylim([-14 2])
legend('Butterworth','Chebyshev I','Chebyshev II','Elliptic', ...

phs = [islinphase(sosb) islinphase(sosc) ...
       islinphase(sosd) islinphase(sose)]
phs = 1x4 logical array

   0   0   0   0

Version History

Introduced in R2013a