Main Content

tfdata

Access transfer function data

    Description

    example

    [num,den] = tfdata(sys) returns the numerator and denominator coefficients of the transfer function for the tf, ss and zpk model objects or the array of model objects represented by sys.

    The outputs num and den are two-dimensional cell arrays if sys contains a single LTI model. When sys is an array of models, num and den are returned as multidimensional cell arrays.

    example

    [num,den,ts] = tfdata(sys) also returns the sample time ts.

    example

    [num,den,ts,sdnum,sdden] = tfdata(sys) also returns the uncertainties in the numerator and denominator coefficients of identified system sys. sdnum{i,j}(k) is the 1 standard uncertainty in the value num{i,j}(k) and sdden{i,j}(k) is the 1 standard uncertainty in the value den{i,j}(k). If sys does not contain uncertainty information, sdnum and sdden are empty [].

    example

    ___ = tfdata(sys,J1,...,JN) extracts the data for the J1,...,JN entry in the model array sys.

    example

    [num,den] = tfdata(sys,'v') returns the numerator and denominator coefficients as row vectors rather than cell arrays for a SISO transfer function represented by sys.

    Examples

    collapse all

    For this example, consider tfData.mat which contains a continuous-time SISO transfer function sys1.

    Load the data and use tfdata to extract the numerator and denominator coefficients.

    load('tfData.mat','sys1');
    [num,den] = tfdata(sys1);

    num and den are returned as cell arrays. To display data, use celldisp.

    celldisp(num)
     
    num{1} =
     
         0     1     5     2
    
     
    
    celldisp(den)
     
    den{1} =
     
         7     4     2     1
    
     
    

    You can also extract the numerator and denominator coefficients as row vectors with the following syntax.

    [num,den] = tfdata(sys1,'v');

    For this example, consider tfData.mat which contains a discrete-time SISO transfer function sys2.

    Load the data and use tfdata to extract the numerator and denominator coefficients along with the sample time.

    load('tfData.mat','sys2');
    [num,den,ts] = tfdata(sys2)
    num = 1x1 cell array
        {1x4 double}
    
    
    den = 1x1 cell array
        {1x4 double}
    
    
    ts = 0.1000
    

    num and den are returned as cell arrays. To display data, use celldisp.

    celldisp(num)
     
    num{1} =
     
         0     0     2     0
    
     
    
    celldisp(den)
     
    den{1} =
     
         4     0     3    -1
    
     
    

    For this example, estimate a transfer function with 2 poles and 1 zero from identified data contained in iddata7.mat with an input delay value.

    Load the identified data and estimate the transfer function.

    load('iddata7.mat');
    sys = tfest(z7,2,1,'InputDelay',[1 0]);

    Extract the numerator, denominator and their standard deviations for the 2-input, 1 output identified transfer function.

    [num,den,~,sdnum,sdden] = tfdata(sys)
    num=1×2 cell array
        {1x3 double}    {1x3 double}
    
    
    den=1×2 cell array
        {1x3 double}    {1x3 double}
    
    
    sdnum=1×2 cell array
        {1x3 double}    {1x3 double}
    
    
    sdden=1×2 cell array
        {1x3 double}    {1x3 double}
    
    

    For this example, extract numerator and denominator coefficients for a specific transfer function contained in the 3x1 array of continuous-time transfer functions sys.

    Load the data and extract the numerator and denominator coefficients of the second model in the array.

    load('tfArray.mat','sys');
    [num,den] = tfdata(sys,2);

    Use celldisp to visualize the data in the cell array num and den.

    celldisp(num)
     
    num{1} =
     
         0     0     2
    
     
    
    celldisp(den)
     
    den{1} =
     
         1     1     2
    
     
    

    Input Arguments

    collapse all

    Dynamic system, specified as a SISO or MIMO dynamic system model, or an array of SISO or MIMO dynamic system models. Dynamic systems that you can use include continuous-time or discrete-time numeric LTI models such as tf, ss and zpk models.

    If sys is a state-space or zero-pole-gain model, it is first converted to transfer function form using tf. For more information on the format of transfer function model data, see the tf reference page.

    For SISO transfer functions, use the following syntax to return the numerator and denominator coefficients directly as row vectors rather than as cell arrays:

    [num,den] = tfdata(sys,'v')
    

    Indices of models in array whose data you want to access, specified as a positive integer. You can provide as many indices as there are array dimensions in sys. For example, if sys is a 4-by-5 array of transfer functions, the following command accesses the data for entry (2,3) in the array.

    [num,den] = tfdata(sys,2,3);

    Output Arguments

    collapse all

    Coefficients of the numerator of the transfer function, returned as a cell array or row vector.

    When sys contains a single LTI model, the output num is returned as a cell array with the following characteristics:

    • num has as many rows as outputs and as many columns as inputs of sys.

    • The (i,j) entries in num{i,j} are row vectors specifying the numerator coefficients of the transfer function from input j to output i. tfdata orders these coefficients in descending powers of s or z.

    When sys contains an array of LTI models, num is returned as a multidimensional cell array of the same size as sys.

    Coefficients of the denominator of the transfer function, returned as a cell array or row vector.

    When sys contains a single LTI model, the output den is returned as a cell array with the following characteristics:

    • den has as many rows as outputs and as many columns as inputs of sys.

    • The (i,j) entries in den{i,j} are row vectors specifying the denominator coefficients of the transfer function from input j to output i. tfdata orders these coefficients in descending powers of s or z.

    When sys contains an array of LTI models, den is returned as a multidimensional cell array of the same size as sys.

    Sample time, returned as a non-negative scalar.

    Standard uncertainty of the numerator coefficients of the identified system sys, returned as a cell array of the same size as num. sdnum{i,j}(k) is the 1 standard uncertainty in the value num{i,j}(k). If sys does not contain uncertainty information, sdnum is empty [].

    Standard uncertainty of the denominator coefficients of the identified system sys, returned as a cell array of the same size as den. sdden{i,j}(k) is the 1 standard uncertainty in the value den{i,j}(k). If sys does not contain uncertainty information, sdden is empty [].

    See Also

    | | | | |

    Introduced before R2006a