Equiripple single-rate FIR filter from specification object
hd = design(d,'equiripple')
hd = design(d,'equiripple',designoption,value,designoption,...value,...)
hd = design(d,'equiripple') designs an equiripple FIR digital filter using the specifications supplied in the object d. Equiripple filter designs minimize the maximum ripple in the passbands and stopbands. hd is a dfilt object
To determine the available design options, use designopts with the specification object and the design method as input arguments as shown.
For complete help about using equiripple, refer to the command line help system. For example, to get specific information about using equiripple with d, the specification object, enter the following at the MATLAB prompt.
First create a lowpass equiripple filter. Assume the data is sampled at 10,000 Hertz. The passband frequency is 500 Hertz with a stopband frequency of 700 Hz. The desired passband ripple is 1 dB with 60 dB of stopband attenuation.
Fs=10000; Hd=fdesign.lowpass('Fp,Fst,Ap,Ast',500,700,1,60,10000); d=design(Hd,'equiripple'); fvtool(d);
Displaying the filter in FVTool shows the equiripple nature of the filter.
The next example designs a lowpass equiripple filter with a direct-form transposed structure and density factor of 20 by specifying the FilterStructure and DensityFactor properties.
To set the design options for the filter, use the designopts method to obtain a structure array containing the current design options.
Change the fields of the structure array to specify your design options and invoke the design method with the structure array as an input argument.
% Use the same filter design as the previous example Fs = 10000; Hd = fdesign.lowpass('Fp,Fst,Ap,Ast',500,700,1,60,10000); % Return the design options for the filter as a struct array opts = designopts(Hd,'equiripple'); fieldnames(opts) % Print out the filter structure- - direct-form FIR opts.FilterStructure % Change the filter structure to direct-form FIR transposed opts.FilterStructure = 'dffirt'; % Change the filter density factor to 20 opts.DensityFactor = 20; % Design the filter d = design(Hd,'equiripple',opts)
An alternate way to design the preceding filter without using the structure array is:
Fs = 10000; Hd = fdesign.lowpass('Fp,Fst,Ap,Ast',500,700,1,60,10000); d = design(Hd,'equiripple','FilterStructure','dffirt','DensityFactor',20);