islinphase
Verify that discrete-time filter System object is linear phase
Syntax
Description
analyzes the filter System object based on the arithmetic specified in the flag
= islinphase(___,Arithmetic=arithType
)arithType
input
using either of the previous syntaxes.
For more input options, see islinphase
in Signal Processing Toolbox™.
Examples
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 = filterAnalyzer(buttIIR,chb1IIR,chb2IIR,ellpIIR,Analysis='phase'); setLegendStrings(fv,["Butterworth","Chebyshev I","Chebyshev II","Elliptic"])
phs = [islinphase(buttIIR) islinphase(chb1IIR) ...
islinphase(chb2IIR) islinphase(ellpIIR)]
phs = 1x4 logical array
0 0 0 0
Input Arguments
sysobj
— Filter System object
filter System object
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, tol
,
defaults to eps^(2/3)
.
arithType
— Arithmetic type
'double'
(default) | 'single'
| 'Fixed'
Arithmetic used in the filter analysis, specified as 'double'
,
'single'
, or '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.
The 'Fixed'
value applies to filter System objects with fixed-point
properties only.
When the '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
'double'
or'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 isLocked
function.
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.
Output Arguments
flag
— Flag to determine if filter has linear phase
true
or 1
| false
or 0
Flag to determine if the filter has linear phase, returned as a logical:
1
–– Filter has linear phase.0
–– Filter has nonlinear phase.
Data Types: logical
Version History
Introduced in R2013aR2024b: Support for dsp.VariableFIRDecimator
and dsp.VariableFIRInterpolator
Objects
Starting in R2024b, the islinphase
analysis function supports the
dsp.VariableFIRDecimator
and dsp.VariableFIRInterpolator
objects.
R2024b: dsp.BiquadFilter
object warns
The dsp.BiquadFilter
object issues a warning and will be removed in a
future release. Use the dsp.SOSFilter
object
instead. For more information on how to replace your existing code, see the
Compatibility Considerations section in the dsp.BiquadFilter
reference page.
R2024b: Support for dsp.DCBlocker
object
Starting in R2024b, this function supports the dsp.DCBlocker
object.
R2023b: Support for dsp.ParallelFilter
and dsp.Delay
Objects
Starting in R2023b, the islinphase
analysis function supports the
dsp.ParallelFilter
and the dsp.Delay
objects.
R2023b: dsp.BiquadFilter
object will be removed
The dsp.BiquadFilter
object will be removed in a future release. Use
the dsp.SOSFilter
object
instead.
See Also
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)