fdesign.interpolator - Interpolator filter specification

Syntax

d = fdesign.interpolator(l)
d = fdesign.interpolator(l,design)
d = fdesign.interpolator(l,design,spec)
d = fdesign.interpolator(...,spec,specvalue1,specvalue2,...)
d = fdesign.interpolator(...,fs)
d = fdesign.interpolator(...,magunits)

Description

d = fdesign.interpolator(l) constructs an interpolating filter specification object d, applying default values for the properties fp, fst, ap, and ast and using the default design, Nyquist. Specify l, the interpolation factor, as an integer. When you omit the input argument l, fdesign.interpolator sets the interpolation factor l to 3.

Using fdesign.interpolator with a design method generates an mfilt object.

d = fdesign.interpolator(l,design) constructs an interpolator with the interpolation factor l and the response you specify in design. By using the design input argument, you can choose the sort of filter that results from using the interpolator specifications object. design accepts the following strings that define the filter response.

design String

Description

arbmag

Sets the response for the interpolator specifications object to Arbitrary Magnitude.

arbmangnphase

Sets the response for the interpolator specifications object to Arbitrary Magnitude and Phase.

bandpass

Sets the response for the interpolator specifications object to bandpass.

bandstop

Sets the response for the interpolator specifications object to bandstop.

cic

Sets the response for the interpolator specifications object to CIC filter.

ciccomp

Sets the response for the interpolator specifications object to CIC compensator.

halfband

Sets the response for the interpolator specifications object to halfband.

highpass

Sets the response for the interpolator specifications object to highpass.

isinclp

Sets the response for the interpolator specifications object to inverse-sinc lowpass.

lowpass

Sets the response for the interpolator specifications object to lowpass.

nyquist

Sets the response for the interpolator specifications object to Nyquist.

d = fdesign.interpolator(l,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.

Design Type

Valid Specification Strings

Arbitrary Magnitude

  • n,b,f,a

  • n,f,a (default string)

Arbitrary Magnitude and Phase

  • n,b,f,h

  • n,f,h (default string)

Bandpass

  • fst1,fp1,fp2,fst2,ast1,ap,ast2 (default string)

  • n,fc1,fc2

  • n,fst1,fp1,fp2,fst2

Bandstop

  • n,fc1,fc2

  • n,fp1,fst1,fst2,fp2

  • fp1,fst1,fst2,fp2,ap1,ast,ap2 (default string)

CIC

  • fp,ast (default and only string)

CIC Compensator

  • fp,fst,ap,ast (default string)

  • n,fc,ap,ast

  • n,fp,ap,ast

  • n,fp,fst

  • n,fst,ap,ast

Halfband

  • tw,ast (default string)

  • n,tw

  • n

  • n,ast

Highpass

  • fst,fp,ast,ap (default string)

  • n,fc

  • n,fc,ast,ap

  • n,fp,ast,ap

  • n,fst,fp,ap

  • n,fst,fp,ast

  • n,fst,ast,ap

  • n,fst,fp

Inverse-Sinc Lowpass

  • fp,fst,ap,ast (default string)

  • n,fc,ap,ast

  • n,fst,ap,ast

  • n,fp,ap,ast

  • n,fp,fst

Lowpass

  • fp,fst,ap,ast (default string)

Nyquist

  • tw,ast (default string)

  • n,tw

  • n

  • n,ast

The string entries are defined as follows:

d = fdesign.interpolator(...,spec,specvalue1,specvalue2,...) constructs an object d and sets its specifications at construction time.

d = fdesign.interpolator(...,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.interpolator(...,magunits) specifies the units for any magnitude specification you provide in the input arguments. magunits can be one of

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.

Examples

These examples show how to construct interpolating filter specification objects. First, create a default specifications object without using input arguments except for the interpolation factor l.

l = 2;
d = fdesign.interpolator(2)

d =
 
          MultirateType: 'Interpolator' 
               Response: 'Nyquist' 
       DecimationFactor: 2      
          Specification: 'TW,Ast'  
            Description: {'Transition Width';'
                           Stopband Attenuation (dB)'}
    NormalizedFrequency: true 
        TransitionWidth: 0.1   
                  Astop: 80                                              

Now create an object by passing a specification string 'fst1,fp1,fp2,fst2,ast1,ap,ast2' and a design — the resulting object uses default values for all of the filter specifications. You must provide the design input argument when you include a specification.

d=fdesign.interpolator(8,'bandpass','fst1,fp1,fp2,fst2,... 
ast1,ap,ast2')
 
d =
 
          MultirateType: 'Interpolator' 
               Response: 'Bandpass'  
       DecimationFactor: 8      
          Specification: 'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2'
            Description: {7x1 cell}   
    NormalizedFrequency: true    
                 Fstop1: 0.35  
                 Fpass1: 0.45   
                 Fpass2: 0.55   
                 Fstop2: 0.65   
                 Astop1: 60  
                  Apass: 1   
                 Astop2: 60                              

Create another interpolating filter object, passing the specification values to the object rather than accepting the default values for, in this case, fp,fst,ap,ast.

d=fdesign.interpolator(3,'lowpass',.45,0.55,.1,60)
 
d =
 
          MultirateType: 'Interpolator'    
               Response: 'Lowpass'      
       DecimationFactor: 3              
          Specification: 'Fp,Fst,Ap,Ast'
            Description: {4x1 cell}     
    NormalizedFrequency: true           
                  Fpass: 0.45           
                  Fstop: 0.55           
                  Apass: 0.1            
                  Astop: 60             

Now pass the filter specifications that correspond to the specifications — n,fc,ap,ast.

d=fdesign.interpolator(3,'ciccomp',1,2,'n,fc,ap,ast',... 
20,0.45,.05,50)
 
d =
 
          MultirateType: 'Interpolator'      
               Response: 'CIC Compensator'
       DecimationFactor: 3                
          Specification: 'N,Fc,Ap,Ast'    
            Description: {4x1 cell}       
       NumberOfSections: 2                
      DifferentialDelay: 1                
    NormalizedFrequency: true             
            FilterOrder: 20               
                Fcutoff: 0.45             
                  Apass: 0.05             
                  Astop: 50               

With the specifications object in your workspace, design an interpolator using the kaiserwin design method.

hm = design(d,'kaiserwin')

Pass a new specification type for the filter, specifying the filter order.

d = fdesign.interpolator(5,'CIC','fp,ast',0.55,55)
 
d =
 
          MultirateType: 'Interpolator' 
               Response: 'CIC'                                            
       DecimationFactor: 5                                                
          Specification: 'Fp,Aa'                                          
            Description: {'Passband Frequency';'Stopband Attenuation(dB)'}
      DifferentialDelay: 1                                                
    NormalizedFrequency: true                                             
                  Fpass: 0.55                                             

In this example, you specify a sampling frequency as the right most input argument. Here, it is set to 1000 Hz.

d=fdesign.interpolator(8,'bandpass','fst1,fp1,fp2,fst2,...
ast1,ap,ast2',0.25,0.35,.55,.65,50,.05,1e3)
 
d =
 
          MultirateType: 'Interpolator'      
               Response: 'Bandpass'                      
       DecimationFactor: 8                               
          Specification: 'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2'
            Description: {7x1 cell}                      
    NormalizedFrequency: false                           
                     Fs: 1000                            
                 Fstop1: 0.25                            
                 Fpass1: 0.35                            
                 Fpass2: 0.55                            
                 Fstop2: 0.65                            
                 Astop1: 50                              
                  Apass: 0.05                            
                 Astop2: 50                              

In this, the last example, use the linear option for the filter specification object and specify the stopband ripple attenuation in linear form.

d = fdesign.interpolator(4,'lowpass','n,fst,ap,ast',15,0.55,.05,... 
     1e3,'linear') % 1e3 = 60dB.
 
d =
 
               Response: 'Lowpass interpolator'  
          Specification: 'TW,Ast'                                        
            Description: {'Transition Width';'Stopband Attenuation (dB)'}
       DecimationFactor: 4                                               
    NormalizedFrequency: false                                           
                     Fs: 500                                             
        TransitionWidth: 0.1                                             
                  Astop: 60                                              

Design the filter and display the magnitude response in FVTool.

designmethods(d);
design(d,'equiripple');  % Opens FVTool.

Now design a CIC interpolator for a signal sampled at 19200 Hz. Specify the differential delay of 2 and set the attenuation of information beyond 50 Hz to be at least 80 dB.

The filter object sampling frequency is (l x fs) where fs is the sampling frequency of the input signal.

dd  = 2;     % Differential delay.
fp  = 50;    % Passband of interest.
ast = 80;    % Minimum attenuation of alias components in passband.
fs  = 600;   % Sampling frequency for input signal.
l   = 32;    % Interpolation factor.
d   = fdesign.interpolator(l,'cic',dd,'fp,ast',fp,ast,l*fs);
d =
 
          MultirateType: 'Interpolator'                                  
    InterpolationFactor: 32                                              
               Response: 'CIC'                                           
          Specification: 'Fp,Ast'                                        
            Description: {'Passband Frequency';'Imaging Attenuation(dB)'}
      DifferentialDelay: 2                                               
    NormalizedFrequency: false                                           
                     Fs: 19200                                           
                  Fs_in: 600                                             
                 Fs_out: 19200                                           
                  Fpass: 50                                              
                  Astop: 80                                              
hm = design(d);  %Use the default design method.
hm
 
hm =
 
        FilterStructure: 'Cascaded Integrator-Comb Interpolator'
             Arithmetic: 'fixed'
      DifferentialDelay: 2
       NumberOfSections: 2
    InterpolationFactor: 32
       PersistentMemory: false
 
        InputWordLength: 16             
        InputFracLength: 15             
                                        
        FilterInternals: 'FullPrecision'

This next example results in a minimum-order CIC compensator that interpolates by 4 and compensates for the droop in the passband for the CIC filter hm from the previous example.

nsecs = hm.numberofsections;
d = fdesign.interpolator(4,'ciccomp',dd,nsecs,... 
50,100,0.1,80,fs);
hmc = design(d,'equiripple');
hmc.arithmetic = 'fixed';

hmc is designed to compensate for hm. To see the effect of the compensating CIC filter, use FVTool to analyze both filters individually and include the compound filter response by cascading hm and hmc.

fvtool(hmc,hm,cascade(hmc,hm),'fs',[fs,l*fs,l*fs],... 
'showreference','off');
legend('CIC Compensator','CIC Interpolator',... 
'Overall Response');

FVTool returns with this plot.

For the third example, use fdesign.interpolator to design a minimum-order Nyquist interpolator that uses a Kaiser window. For comparison, design a multistage interpolator as well and compare the responses.

l   = 15;   % Set the interpolation factor and the Nyquist band.
tw  = 0.05; % Specify the normalized transition width.
ast = 40;   % Set the minimum stopband attenuation in dB.
d   = fdesign.interpolator(l,'nyquist',l,tw,ast);
hm  = design(d,'kaiserwin');  
hm2 = design(d,'multistage'); % Design the multistage interpolator.
fvtool(hm,hm2);
legend('Kaiser Window','Multistage')

FVTool shows both responses.

Design a lowpass interpolator for an interpolation factor of 8. Compare the single-stage equiripple design to a multistage design with the same interpolation factor.

l = 8; % Interpolation factor.
d = fdesign.interpolator(l,'lowpass');
hm(1) = design(d,'equiripple');
% Use halfband filters whenever possible.
hm(2) = design(d,'multistage','usehalfbands',true); 
fvtool(hm); 
legend('Single-Stage Equiripple','Multistage')

See Also

fdesign, fdesign.arbmag, fdesign.arbmagnphase, fdesign.decimator, fdesign.rsrc, setspecs

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS