Documentation Center 
Compare model output and measured output
compare(data,sys)
compare(data,sys,prediction_horizon)
compare(data,sys,style,prediction_horizon)
compare(data,sys1,...,sysN,prediction_horizon)
compare(data,sys1,style1,...,sysN,styleN,prediction_horizon)
compare(___,opt)
[y,fit,x0]
= compare(___)
compare(data,sys) plots the simulated response of a dynamic system model, sys, superimposed over validation data, data, for comparison. The plot also displays the normalized root mean square (NRMSE) measure of the goodness of the fit.
The matching of the input/output channels in data and sys is based on the channel names. Thus, it is possible to evaluate models that do not use all the input channels that are available in data.
compare(data,sys,prediction_horizon) compares the predicted response of sys to the measured response in data. Measured output values in data up to time tprediction_horizon are used to predict the output of sys at time t.
compare(data,sys,style,prediction_horizon) uses style to specify the line type, marker symbol, and color.
compare(data,sys1,...,sysN,prediction_horizon) compares multiple dynamic systems responses on the same axes. compare automatically chooses colors and line styles in the order specified by the ColorOrder and LineStyleOrder properties of the current axes.
compare(data,sys1,style1,...,sysN,styleN,prediction_horizon) compares multiple systems responses on the same axes using the line type, marker symbol, and color specified for each system.
compare(___,opt) configures the comparison using an option set, opt.
[y,fit,x0] = compare(___) returns the model response, y, goodness of fit value, fit, and the initial states, x0. No plot is generated.
data 
Validation data. Specify data as either an iddata or idfrd object. If sys is an iddata object, then data must be an iddata object with matching domain, number of experiments and time or frequency vectors. If sys is a frequency response model (idfrd or frd), then data must be a frequency response model too. data can represent either time or frequencydomain data when comparing with linear models. data must be timedomain data when comparing with a nonlinear model. For frequency domain data, the real and imaginary parts of the corresponding frequency functions are shown in separate axes. When data is an FRD model, the frequency responses of data and sys are plotted. 
sys 
iddata object or dynamic system model. When the time or frequency units of data do not match those of sys, sys is rescaled to match the units of data. 
prediction_horizon 
Prediction horizon. Specify prediction_horizon as Inf to obtain a pure simulation of the system. prediction_horizon is ignored when sys is an iddata object, an FRD model or a dynamic system with no noise component. prediction_horizon is also ignored when using frequency response validation data. For timeseries models, use a finite value for prediction_horizon. Default: Inf 
style 
Line style, marker, and color of both the linear and marker, specified as a one, two, or threepart string enclosed in single quotes (' '). The elements of the string can appear in any order. The string can specify only the line style, the marker, or the color. For more information about configuring the style string, see Specify Line Style, Color, and Markers in the MATLAB^{®} documentation. 
opt 
Comparison option set. opt is an option set created using compareOptions, which specifies options including:

y 
Model response. Measured output values in data up to time t = tprediction_horizon are used to predict the output of sys at time t. For multimodel comparisons, y is a cell array, with one entry for each input model. For multiexperiment data, y is a cell array, with one entry for each experiment. For multimodel comparisons using multiexperiment data, y is an NsysbyNexp cell array. Nsys is the number of models, and Nexp is the number of experiments. If sys is a model array, then y is an array, with an entry corresponding to each model in sys and experiment in data. 
fit 
NRMSE fitness value. The fit is calculated (in percentage) using:
where y is the validation data output and is the output of sys. For FRD models, fit is calculated by comparing the complex frequency response. The magnitude and phase curves shown in the plot are not compared separately. If data is an iddata object, fit is an Nyby1 vector, where Ny is the number of outputs. If data is an FRD model with Ny outputs and Nu inputs, fit is an NybyNu matrix. Each entry of fit corresponds to an input/output pair in sys. For multimodel comparisons, fit is a cell array, with one entry for each input model. For multiexperiment data, fit is a cell array, with one entry for each experiment. For multimodel comparisons using multiexperiment data, fit is an NsysbyNexp cell array. Nsys is the number of models, and Nexp is the number of experiments. 
x0 
Initial conditions used to compute system response. When sys is an frd or iddata object, x0 is []. For multimodel comparisons, x0 is a cell array, with one entry for each input model. For multiexperiment data, x0 is a cell array, with one entry for each experiment. For multimodel comparisons using multiexperiment data, x0 is an NsysbyNexp cell array. Nsys is the number of models, and Nexp is the number of experiments. 
bode  chgFreqUnit  chgTimeUnit  compareOptions  forecast  goodnessOfFit  interp  predict  resid  sim