Halfband filter specification object
d = fdesign.halfband
d = fdesign.halfband('type',type)
d = fdesign.halfband(
d = fdesign.halfband(spec,specvalue1,specvalue2,...)
d = fdesign.halfband(specvalue1,specvalue2)
d = fdesign.
d = fdesign.
a halfband filter specification object
d = fdesign.halfband
default values for the properties
fdesign.halfband with a design method
d = fdesign.halfband('type',type) initializes
the filter designer 'Type' property with
type' must be either
is not case sensitive.
d = fdesign.halfband( constructs
d and sets its '
spec. Entries in
various filter response features, such as the filter order, that govern
the filter design. Valid entries for
shown below. These options are not case sensitive.
ast — attenuation in the
stop band in decibels (the default units).
n — filter order.
tw — width of the transition
region between the pass and stop bands. Specified in normalized frequency
By default, all frequency specifications are assumed to be in normalized frequency units. Moreover, all magnitude specifications are assumed to be in dB. Different specification types may have different design methods available.
The filter design methods that apply to a halfband filter specification
object change depending on the
designmethods to determine
which design method applies to an object and its specification choice.
Different filter design methods also have options that you can specify.
designopts with the design
method to see the available options. For example:
d = fdesign.halfband(spec,specvalue1,specvalue2,...) constructs
d and sets its specifications at construction
d = fdesign.halfband(specvalue1,specvalue2) constructs
d assuming the default
using the values you provide for the input arguments
d = fdesign. adds
fs, specified in Hz to define the
sampling frequency to use. In this case, all frequencies in the specifications
are in Hz as well.
d = fdesign. specifies
the units for any magnitude specification you provide in the input
magunits can be one of
linear — specify the magnitude
in linear units
dB — specify the magnitude
in dB (decibels)
squared — specify the magnitude
in power units
When you omit the
that all magnitudes are in decibels. Note that
all magnitude specifications in decibels (converting to decibels when
necessary) regardless of how you specify the magnitudes.
Create a default halfband filter specifications object:
Create another halfband filter object, passing the specification
values to the object rather than accepting the default values for
d = fdesign.halfband('n,ast', 42, 80);
For another example, pass the filter values that correspond
to the default
d = fdesign.halfband(.01, 80);
This example designs an equiripple FIR filter, starting by passing
a new specification type and specification values to
hs = fdesign.halfband('n,ast',80,70); hd =design(hs,'equiripple'); % Opens FVTool automatically.
In this example, pass the specifications for the filter, and
then design a least-squares FIR filter from the object, using
firls as the design method.
hs = fdesign.halfband('n,tw', 42, .04); % designmethods(hs) hd=design(hs,'firls');
Create two equiripple halfband filters with and without a nonnegative zero phase response:
f=fdesign.halfband('N,TW',12,0.2); % Equiripple halfband filter with nonnegative zero phase response Hd1=design(f,'equiripple','ZeroPhase',true); % Equiripple halfband filter with zero phase false % 'zerophase',false is the default Hd2=design(f,'equiripple','ZeroPhase',false); %Obtain real-valued amplitudes (not magnitudes) [Hr_zerophase,W]=zerophase(Hd1); [Hr,W]=zerophase(Hd2); % Plot and compare response plot(W,Hr_zerophase,'k','linewidth',2); xlabel('Radians/sample'); ylabel('Amplitude'); hold on; plot(W,Hr,'r'); axis tight; grid on; legend('with ''ZeroPhase'', true','with ''ZeroPhase'' false');
Note that the amplitude of the zero phase response (black line) is nonnegative for all frequencies.
'ZeroPhase' option is valid only for
equiripple halfband designs with the
You cannot specify