Design an FIR equiripple lowpass filter. Specify a passband edge frequency of 0.2π rad/sample and a stopband edge frequency of 0.25π rad/sample. Set the passband ripple to 0.5 dB and the stopband attenuation to 40 dB..
designSpecs =
lowpass with properties:
Response: 'Lowpass'
Specification: 'Fp,Fst,Ap,Ast'
Description: {4×1 cell}
NormalizedFrequency: 1
Fpass: 0.2000
Fstop: 0.2500
Apass: 0.5000
Astop: 40
Use the default Equiripple method to design the filter.
filt =
dsp.FIRFilter with properties:
Structure: 'Direct form'
NumeratorSource: 'Property'
Numerator: [-0.0057 -0.0010 0.0010 0.0040 0.0065 0.0073 0.0055 0.0014 -0.0033 -0.0066 -0.0067 -0.0029 0.0033 0.0091 0.0114 0.0083 4.2874e-04 -0.0091 -0.0158 -0.0154 -0.0070 0.0069 0.0202 0.0259 0.0193 5.1049e-04 -0.0239 … ] (1×69 double)
InitialConditions: 0
Show all properties
Determine the available design methods by running the designmethods
function on the filter design specification object, designSpecs
.
Design Methods that support System objects for class fdesign.lowpass (Fp,Fst,Ap,Ast):
butter
cheby1
cheby2
ellip
equiripple
ifir
kaiserwin
multistage
You can also specify the design options used in designing the filter. To see a list of available options, run the designoptions
function on designSpecs
.
ans = struct with fields:
FilterStructure: {'dffir' 'dffirt' 'dfsymfir' 'fftfir'}
DensityFactor: 'double'
MinPhase: 'bool'
MaxPhase: 'bool'
MinOrder: {'any' 'even' 'odd'}
StopbandShape: {'flat' 'linear' '1/f'}
StopbandDecay: 'double'
UniformGrid: 'bool'
SystemObject: 'bool'
DefaultFilterStructure: 'dffir'
DefaultDensityFactor: 16
DefaultMaxPhase: 0
DefaultMinOrder: 'any'
DefaultMinPhase: 0
DefaultStopbandDecay: 0
DefaultStopbandShape: 'flat'
DefaultSystemObject: 0
DefaultUniformGrid: 1
Design a minimum-phase FIR equiripple filter by setting 'MinPhase'
to true
.
filtMin =
dsp.FIRFilter with properties:
Structure: 'Direct form'
NumeratorSource: 'Property'
Numerator: [0.0163 0.0381 0.0724 0.1143 0.1562 0.1875 0.1981 0.1814 0.1378 0.0750 0.0071 -0.0499 -0.0824 -0.0846 -0.0593 -0.0181 0.0236 0.0514 0.0571 0.0412 0.0117 -0.0188 -0.0385 -0.0411 -0.0272 -0.0040 0.0182 0.0308 0.0295 … ] (1×59 double)
InitialConditions: 0
Show all properties
Display pole-zero plots of the default and minimum-phase designs.
Redesign the filter using the elliptic method. Determine the available design options for the elliptic method.
ans = struct with fields:
FilterStructure: {'df1sos' 'df2sos' 'df1tsos' 'df2tsos' 'cascadeallpass' 'cascadewdfallpass'}
SOSScaleNorm: 'ustring'
SOSScaleOpts: 'fdopts.sosscaling'
MatchExactly: {'passband' 'stopband' 'both'}
SystemObject: 'bool'
DefaultFilterStructure: 'df2sos'
DefaultMatchExactly: 'both'
DefaultSOSScaleNorm: ''
DefaultSOSScaleOpts: [1×1 fdopts.sosscaling]
DefaultSystemObject: 0
Match the passband exactly by setting 'MatchExactly'
to 'passband'
.
filt =
dsp.SOSFilter with properties:
Structure: 'Direct form II'
CoefficientSource: 'Property'
Numerator: [3×3 double]
Denominator: [3×3 double]
HasScaleValues: true
ScaleValues: [0.2868 0.1982 0.2819 1]
Show all properties
You can specify the Pth norm scaling on the second-order sections. Use L-infinity norm scaling in the time domain.
filtL =
dsp.SOSFilter with properties:
Structure: 'Direct form II'
CoefficientSource: 'Property'
Numerator: [3×3 double]
Denominator: [3×3 double]
HasScaleValues: false
Show all properties
Display the frequency responses of the filters.