Main Content

Extracting Numerical Model Data

You can extract the following numerical data from linear model objects:

  • Coefficients and uncertainty

    For example, extract state-space matrices (A, B, C, D and K) for state-space models, or polynomials (A, B, C, D and F) for polynomial models.

    If you estimated model uncertainty data, this information is stored in the model in the form of the parameter covariance matrix. You can fetch the covariance matrix (in its raw or factored form) using the getcov command. The covariance matrix represents uncertainties in parameter estimates and is used to compute:

    • Confidence bounds on model output plots, Bode plots, residual plots, and pole-zero plots

    • Standard deviation in individual parameter values. For example, one standard deviation in the estimated value of the A polynomial in an ARX model, returned by the polydata command and displayed by the present command.

    The following table summarizes the commands for extracting model coefficients and uncertainty.

    Commands for Extracting Model Coefficients and Uncertainty Data

    freqrespExtracts frequency-response data (H) and corresponding covariance (CovH) from any linear identified model.
    [H,w,CovH] = freqresp(m)
    polydataExtracts polynomials (such as A) from any linear identified model. The polynomial uncertainties (such as dA) are returned only for idpoly models.
    [A,B,C,D,F,dA,dB,dC,dD,dF] = ...
    idssdataExtracts state-space matrices (such as A) from any linear identified model. The matrix uncertainties (such as dA) are returned only for idss models.
     dA,dB,dC,dD,dK,dX0] = ...
    tfdataExtracts numerator and denominator polynomials (Num, Den) and their uncertainties (dnum, dden) from any linear identified model.
    [Num,Den,Ts,dNum,dDen] = ...
    zpkdataExtracts zeros, poles, and gains (Z, P, K) and their covariances (covZ, covP, covK) from any linear identified model.
    [Z,P,K,Ts,covZ,covP,covK] = ...
    getpvecObtain a list of model parameters and their uncertainties.
    To access parameter attributes such as values, free status, bounds or labels, use getpar.
    pvec = getpvec(m)															
    getcovObtain parameter covariance information
    cov_data = getcov(m)															

    You can also extract numerical model data by using dot notation to access model properties. For example, m.A displays the A polynomial coefficients from model m. Alternatively, you can use the get command, as follows: get(m,'A').


    To view a list of model properties, type get(model).

  • Dynamic and noise models

    For linear models, the general symbolic model description is given by:


    G is an operator that takes the measured inputs u to the outputs and captures the system dynamics, also called the measured model. H is an operator that describes the properties of the additive output disturbance and takes the hypothetical (unmeasured) noise source inputs e to the outputs, also called the noise model. When you estimate a noise model, the toolbox includes one noise channel e for each output in your system.

You can operate on extracted model data as you would on any other MATLAB® vectors, matrices and cell arrays. You can also pass these numerical values to Control System Toolbox™ commands, for example, or Simulink® blocks.