You are here : matlabSignal Processingislinphase

islinphase() - Signal Processing

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).flag = islinphase(hs,...) determines
whether the filter System object™, hs, has linear
phase. You must have the DSP System Toolbox™ to use islinphase with
a System object.flag = islinphase(hs,'Arithmetic',arithtype) analyzes
the filter System object hs based on the specified arithtype. arithtype can
be one of 'double', 'single',
or 'fixed'. When you specify 'double' or 'single',
the function performs double- or single-precision analysis. When you
specify 'fixed' , the arithmetic changes depending
on the setting of the CoefficientDataType property
and whether the System object is locked or unlocked. You must
have the DSP System Toolbox to use islinphase with
a System object. Details for Fixed-Point Arithmetic

System Object StateCoefficient Data TypeRule
Unlocked'Same as input'The function assumes that the coefficient data type is signed,
16 bit, and autoscaled. The function performs fixed-point analysis
based on this assumption.
Unlocked'Custom'The function performs fixed-point analysis based on the setting
of the CustomCoefficientsDataType property.
Locked'Same as input'When the input data type is 'double' or 'fixed',
the function assumes that the coefficient data type is signed, 16-bit,
and autoscaled. The function performs fixed-point analysis based on
this assumption.
Locked'Custom'The function performs fixed-point analysis based on the setting
of the CustomCoefficientsDataType property.


When you do not specify the arithmetic for non-CIC structures,
the function uses double-precision arithmetic if the filter System object is
in an unlocked state. If the System object is locked, the function
performs analysis based on the locked input data type. CIC structures
only support fixed-point arithmetic.flag = islinphase(h) determines
if the dfilt filter object h has
linear phase.


Syntax

flag = islinphase(b,a)flag = islinphase(sos)flag = islinphase(d)flag = islinphase(...,tol)flag = islinphase(hs,...)flag = islinphase(hs,'Arithmetic',arithtype)flag = islinphase(h)


Example

Linear and Nonlinear PhaseOpen This Example
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', ...
    'FilterOrder',10,'CutoffFrequency',0.55);
flag = islinphase(d)
[phs,w] = phasez(d);

plot(w/pi,phs)
xlabel('Frequency \omega/\pi')
ylabel('Phase')

flag =

     1


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.fv = fvtool(sosb,sosc,sosd,sose,'Analysis','phase');
legend(fv,'Butterworth','Chebyshev I','Chebyshev II','Elliptic')

phs = [islinphase(sosb) islinphase(sosc) ...
       islinphase(sosd) islinphase(sose)]

phs =

     0     0     0     0


Output / Return Value


Limitations


Alternatives / See Also


Reference