Verify that discrete-time filter System object is linear phase
Linear and Nonlinear Phase Filters
Use the window method to design a 10th order lowpass FIR filter with the normalized cutoff frequency of 0.55. Verify that the filter has linear phase.
firSpecs = fdesign.lowpass('N,Fc',10,0.55); lpFIR = design(firSpecs,'window',SystemObject=true)
lpFIR = dsp.FIRFilter with properties: Structure: 'Direct form' NumeratorSource: 'Property' Numerator: [0.0036 0.0078 -0.0375 -0.0334 0.2856 0.5477 0.2856 -0.0334 -0.0375 0.0078 0.0036] InitialConditions: 0 Use get to show all properties
flag = islinphase(lpFIR)
flag = logical 1
Plot the phase response of the filter and verify that it is linear.
[phs,w] = phasez(lpFIR); plot(w/pi,phs) xlabel('Frequency \omega/\pi') ylabel('Phase')
IIR filters in general do not have linear phase. Verify this by constructing Butterworth, Chebyshev, and elliptic filters with similar specifications. Set the passband frequency to 0.35, stopband frequency to 0.4, passband ripple to 1 dB, and stopband attenuation to 20 dB.
Wp = 0.35; Wst = 0.4; atten = 20; rippl = 1; buttSpecs = fdesign.lowpass('Fp,Fst,Ap,Ast',Wp,Wst,rippl,atten); buttIIR = design(buttSpecs,'butter',SystemObject=true); chb1Specs = fdesign.lowpass('Fp,Fst,Ap,Ast',Wp,Wst,rippl,atten); chb1IIR = design(chb1Specs,'cheby1',SystemObject=true); chb2Specs = fdesign.lowpass('Fp,Fst,Ap,Ast',Wp,Wst,rippl,atten); chb2IIR = design(chb2Specs,'cheby2',SystemObject=true); ellpSpecs = fdesign.lowpass('Fp,Fst,Ap,Ast',Wp,Wst,rippl,atten); ellpIIR = design(ellpSpecs,'ellip',SystemObject=true);
Plot the phase responses of the filters. Determine whether they have linear phase.
fv = fvtool(buttIIR,chb1IIR,chb2IIR,ellpIIR,Analysis='phase'); legend(fv,'Butterworth','Chebyshev I','Chebyshev II','Elliptic')
phs = [islinphase(buttIIR) islinphase(chb1IIR) ... islinphase(chb2IIR) islinphase(ellpIIR)]
phs = 1x4 logical array 0 0 0 0
sysobj — Filter System object
filter System object
Input filter, specified as one of the following filter System objects:
tol — Tolerance value
eps^(2/3) (default) | positive scalar
Tolerance value to determine when two numbers are close enough to be considered
equal, specified as a positive scalar. If not specified,
arithType — Arithmetic type
'double' (default) |
Arithmetic used in the filter analysis, specified as
'Fixed'. When the arithmetic
input is not specified and the filter System object is unlocked, the analysis tool assumes a double-precision filter. When the
arithmetic input is not specified and the System object is locked, the function performs the analysis based on the data type of
the locked input.
'Fixed' value applies to filter System objects with fixed-point
'Arithmetic' input argument is specified as
'Fixed' and the filter object has the data type of the
coefficients set to
'Same word length as input', the arithmetic
analysis depends on whether the System object is unlocked or locked.
unlocked –– The analysis object function cannot determine the coefficients data type. The function assumes that the coefficients data type is signed, has a 16-bit word length, and is auto scaled. The function performs fixed-point analysis based on this assumption.
locked –– When the input data type is
'single', the analysis object function cannot determine the coefficients data type. The function assumes that the data type of the coefficients is signed, has a 16-bit word length, and is auto scaled. The function performs fixed-point analysis based on this assumption.
To check if the System object is locked or unlocked, use the
When the arithmetic input is specified as
'Fixed' and the filter
object has the data type of the coefficients set to a custom numeric type, the object
function performs fixed-point analysis based on the custom numeric data type.
flag — Flag to determine if filter has linear phase
Flag to determine if the filter has linear phase, returned as a logical:
1–– Filter has linear phase.
0–– Filter has nonlinear phase.