Main Content

filt

Specify discrete transfer functions in DSP format

    Description

    Use filt to create discrete-time transfer function models in digital signal processing (DSP) form for use with Control System Toolbox™ linear analysis and control design tools. To apply a filter to vector data, see filter.

    In DSP, it is conventional to use transfer functions as rational expressions in z−1 and to order the numerator and denominator terms in ascending powers of z−1. For example:

    H(z1)=2+z11+0.4z1+2z2

    filt creates a tf object with the Variable property set to 'z^-1'. For more information, see tf.

    example

    sys = filt(numerator,denominator) creates a discrete-time transfer function model in DSP form using the coefficients specified in the numerator and denominator arguments. The sample time is left unspecified. For more information, see the tf reference page.

    example

    sys = filt(numerator,denominator,ts) sets the sample time of the discrete-time transfer function.

    sys = filt(m) creates a discrete-time transfer function model that represents the static gain matrix, m.

    example

    sys = filt(___,Name,Value) sets properties of the discrete-time transfer function model using one or more Name,Value pair arguments for any of the previous input-argument combinations. For information about the available properties and their values, see the tf reference page.

    Examples

    collapse all

    For this example, create a discrete-time transfer function model in DSP form using the filt command.

    First, specify the numerator and denominator coefficients in ascending orders of z^-1.

    numerator = [2,5,7];
    denominator = [6,8,3];

    Use filt to create the required DSP-oriented transfer function model.

    sys = filt(numerator,denominator)
    sys =
     
      2 + 5 z^-1 + 7 z^-2
      -------------------
      6 + 8 z^-1 + 3 z^-2
     
    Sample time: unspecified
    Discrete-time transfer function.
    

    sys is a discrete-time transfer function model in DSP form with the sample time unspecified, that is, the coefficients are ordered in increasing powers of z^-1.

    Alternatively, you can create the same model using the tf command by setting the Variable property to z^-1.

    systf = tf(numerator,denominator,-1,'Variable','z^-1')
    systf =
     
      2 + 5 z^-1 + 7 z^-2
      -------------------
      6 + 8 z^-1 + 3 z^-2
     
    Sample time: unspecified
    Discrete-time transfer function.
    

    For this example, create a DSP-oriented discrete-time transfer function model with a sample time 0.2 seconds.

    First, specify the numerator and denominator coefficients in ascending powers of z^-1.

    numerator = [2,9];
    denominator = [3,5,7,1];
    ts = 0.2;

    Next, create the required transfer function model using filt.

    sys = filt(numerator,denominator,ts)
    sys =
     
              2 + 9 z^-1
      --------------------------
      3 + 5 z^-1 + 7 z^-2 + z^-3
     
    Sample time: 0.2 seconds
    Discrete-time transfer function.
    

    sys is a discrete-time transfer function model in DSP form with a sample time of 0.2 seconds. The coefficients are ordered in ascending orders of z^-1 for a DSP-oriented transfer function model.

    For this example, create a two-input discrete-time transfer function model in DSP format and name the inputs channel1 and channel2, respectively.

    numerator = {1,[1 0.3]};
    denominator = {[1 1 2],[5 2]};
    sys = filt(numerator,denominator,'InputName',{'channel1' 'channel2'})
    sys =
     
      From input "channel1" to output:
              1
      -----------------
      1 + z^-1 + 2 z^-2
     
      From input "channel2" to output:
      1 + 0.3 z^-1
      ------------
       5 + 2 z^-1
     
    Sample time: unspecified
    Discrete-time transfer function.
    

    Alternatively, you can also use the tf command to create the same discrete-time transfer function model by setting the Variable property to z^-1.

    systf = tf(numerator,denominator,-1,'InputName',{'channel1' 'channel2'},'Variable','z^-1')
    systf =
     
      From input "channel1" to output:
              1
      -----------------
      1 + z^-1 + 2 z^-2
     
      From input "channel2" to output:
      1 + 0.3 z^-1
      ------------
       5 + 2 z^-1
     
    Sample time: unspecified
    Discrete-time transfer function.
    

    Input Arguments

    collapse all

    Numerator coefficients, specified as:

    • A row vector of polynomial coefficients in order of ascending powers of 'z^-1'.

    • An Ny-by-Nu cell array of row vectors to specify a MIMO transfer function, where Ny is the number of outputs and Nu is the number of inputs. Each element of the cell array specifies the numerator coefficients for a given input/output pair. If you specify both Numerator and Denominator as cell arrays, they must have the same dimensions.

    The coefficients of Numerator can be either real-valued or complex-valued.

    Denominator coefficients, specified as:

    • A row vector of polynomial coefficients in order of ascending powers of 'z^-1'.

    • An Ny-by-Nu cell array of row vectors to specify a MIMO transfer function, where Ny is the number of outputs and Nu is the number of inputs. Each element of the cell array specifies the numerator coefficients for a given input/ output pair. If you specify both Numerator and Denominator as cell arrays, they must have the same dimensions.

    If all SISO entries of a MIMO transfer function have the same denominator, you can specify Denominator as the row vector while specifying Numerator as a cell array.

    The coefficients of Denominator can be either real-valued or complex-valued.

    Sample time, specified as:

    • A positive scalar representing the sampling period of a discrete-time system. Specify ts in the time unit specified by the TimeUnit property of the transfer function object.

    • -1 for a discrete-time system with an unspecified sample time.

    Static gain, specified as a scalar or matrix. Static gain or steady state gain of a system represents the ratio of the output to the input under steady state condition.

    Output Arguments

    collapse all

    Discrete-time transfer function in DSP format, returned as a transfer function (tf) model object with the Variable property set to 'z^-1'. For more information, see the tf reference page.

    Version History

    Introduced before R2006a

    See Also