| Filter Design Toolbox™ | ![]() |
d = fdesign.rsrc(l,m)
d = fdesign.rsrc(...,design)
d = fdesign.rsrc(...,design,spec)
d = fdesign.rsrc(...,spec,specvalue1,specvalue2,...)
d = fdesign.rsrc(...,fs)
d = fdesign.rsrc(...,magunits)
d = fdesign.rsrc(l,m) constructs a rational-factor sample-rate convertor filter specification object d, applying default values for the properties tw and ast and using the default design, Nyquist. Specify l and m, the interpolation and decimation factors, as integers.
l/m is the rational-factor for the rate change. When you omit the input argument l or m or both, fdesign.rsrc sets the values to defaults — the interpolation factor (if omitted) to 3 and the decimation factor (if omitted) to 2. The default rate change factor is 3/2 .
Using fdesign.rsrc with a design method generates an mfilt object.
d = fdesign.rsrc(...,design) constructs an rational-factor sample-rate converter with the interpolation factor l, decimation factor m, and the response you specify in design. Using the design input argument lets you choose the sort of filter that results from using the rational-factor sample-rate converter specifications object. design accepts the following strings that define the filter response.
design String | Description |
|---|---|
arbmag | Sets the design for the rational-factor sample-rate converter specifications object to Arbitrary Magnitude. |
arbmagnphase | Sets the design for the rational-factor sample-rate converter specifications object to Arbitrary Magnitude and Phase. |
bandpass | Sets the design for the rational-factor sample-rate converter specifications object to bandpass. |
bandstop | Sets the design for the rational-factor sample-rate converter specifications object to bandstop. |
cic | Sets the design for the rational-factor sample-rate converter specifications object to CIC filter. |
ciccomp | Sets the design for the rational-factor sample-rate converter specifications object to CIC compensator. |
halfband | Sets the design for the rational-factor sample-rate converter specifications object to halfband. |
highpass | Sets the design for the rational-factor sample-rate converter specifications object to highpass. |
isinclp | Sets the design for the rational-factor sample-rate converter specifications object to inverse-sinc lowpass. |
lowpass | Sets the design for the rational-factor sample-rate converter specifications object to lowpass. |
nyquist | Sets the design for the rational-factor sample-rate converter specifications object to Nyquist. |
d = fdesign.rsrc(...,design,spec) constructs object d and sets its Specification property to spec. Entries in the spec string represent various filter response features, such as the filter order, that govern the filter design. Valid entries for spec depend on the design type of the specifications object.
When you add the spec input argument, you must also add the design input argument.
Because you are designing multirate filters, the specification strings available are not the same as the specifications for designing single-rate filters with such design methods as fdesign.lowpass. The strings are not case sensitive.
The interpolation factor l is not in the specification strings. Various design types provide different specifications. as shown in this table. In the third column, you see the filter design methods that apply to specifications objects that use the specification string in column two.
Design Type | Valid Specification Strings |
|---|---|
Arbitrary Magnitude |
|
Arbitrary Magnitude and Phase |
|
Bandpass |
|
Bandstop |
|
CIC |
|
CIC Compensator |
|
Halfband |
|
Highpass |
|
Inverse-Sinc Lowpass |
|
Lowpass |
|
Nyquist |
|
The string entries are defined as follows:
a — amplitude vector. Values in a define the filter amplitude at frequency points you specify in f, the frequency vector. If you use a, you must use f as well. Amplitude values must be real.
ap — amount of ripple allowed in the pass band in decibels (the default units). Also called Apass.
ap1 — amount of ripple allowed in the pass band in decibels (the default units). Also called Apass1. Bandpass and bandstop filters use this option.
ap2 — amount of ripple allowed in the pass band in decibels (the default units). Also called Apass2. Bandpass and bandstop filters use this option.
ast — attenuation in the first stop band in decibels (the default units). Also called Astop.
ast1 — attenuation in the first stop band in decibels (the default units). Also called Astop1. Bandpass and bandstop filters use this option.
ast2 — attenuation in the first stop band in decibels (the default units). Also called Astop2. Bandpass and bandstop filters use this option.
b — number of bands in the multiband filter
f — frequency vector. Frequency values in f specify locations where you provide specific filter response amplitudes. When you provide f you must also provide a.
fc1 — cutoff frequency for the point 3 dB point below the passband value for the first cutoff. Specified in normalized frequency units. Bandpass and bandstop filters use this option.
fc2 — cutoff frequency for the point 3 dB point below the passband value for the second cutoff. Specified in normalized frequency units. Bandpass and bandstop filters use this option.
fp1 — frequency at the start of the pass band. Specified in normalized frequency units. Also called Fpass1. Bandpass and bandstop filters use this option.
fp2 — frequency at the end of the pass band. Specified in normalized frequency units. Also called Fpass2. Bandpass and bandstop filters use this option.
fst1 — frequency at the end of the first stop band. Specified in normalized frequency units. Also called Fstop1. Bandpass and bandstop filters use this option.
fst2 — frequency at the start of the second stop band. Specified in normalized frequency units. Also called Fstop2. Bandpass and bandstop filters use this option.
h — complex frequency response values.
n — filter order.
tw — width of the transition region between the pass and stop bands. Both halfband and Nyquist filters use this option.
d = fdesign.rsrc(...,spec,specvalue1,specvalue2,...) constructs an object d and sets its specifications at construction time.
d = fdesign.rsrc(...,fs) adds the argument 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.rsrc(...,magunits) specifies the units for any magnitude specification you provide in the input arguments. 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 magunits argument, fdesign assumes that all magnitudes are in decibels. Note that fdesign stores all magnitude specifications in decibels (converting to decibels when necessary) regardless of how you specify the magnitudes.
This series of examples demonstrates progressively more complete techniques for creating rational sample-rate change filters. First, pass the filter design specifications directly to the Nyquist design type. Then use kaiserwin, one of the valid design methods, to design the rate change filter.
d = fdesign.rsrc(5,3,'nyquist',5,.05,40); designmethods(d) hm = design(d,'kaiserwin'); % Use Kaiser window to design rate changer.
For this example, specify the filter order (12) when you create the specifications object d.
d = fdesign.rsrc(5,3,'nyquist',5,'n,tw',12)
Expand the input arguments by specify a sampling frequency for the filter. Recall that the sampling frequency for rate changers refers to the input sample rate times the interpolation factor.
d = fdesign.rsrc(5,3,'nyquist',5,'n,tw',12,0.1,5) designmethods(d); design(d,'equiripple'); % Opens FVTool.
Specify a stopband ripple in linear units.
d = fdesign.rsrc(4,7,'nyquist',5,'tw,ast',.1,1e-3,5,... 'linear') % 1e-3 = 60dB attenuation in the stopband.
design, designmethods, fdesign.decimator, fdesign.interpolator, setspecs, fdesign.arbmag, fdesign.arbmagnphase
![]() | fdesign.pulseshaping | fftcoeffs | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |