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,DandK) for state-space models, or polynomials (A,B,C,DandF) 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
getcovcommand. 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
Apolynomial in an ARX model, returned by thepolydatacommand and displayed by thepresentcommand.
The following table summarizes the commands for extracting model coefficients and uncertainty.
Commands for Extracting Model Coefficients and Uncertainty Data
Command Description Syntax 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 asdA) are returned only foridpolymodels.[A,B,C,D,F,dA,dB,dC,dD,dF] = ... polydata(m)idssdataExtracts state-space matrices (such as A) from any linear identified model. The matrix uncertainties (such asdA) are returned only foridssmodels.[A,B,C,D,K,X0,... dA,dB,dC,dD,dK,dX0] = ... idssdata(m)tfdataExtracts numerator and denominator polynomials ( Num,Den) and their uncertainties (dnum,dden) from any linear identified model.[Num,Den,Ts,dNum,dDen] = ... tfdata(m)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] = ... zpkdata(m)getpvecObtain a list of model parameters and their uncertainties.
To access parameter attributes such as values, free status, bounds or labels, usegetpar.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.Adisplays the A polynomial coefficients from modelm. Alternatively, you can use thegetcommand, as follows:get(m,'A').Tip
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.