sim - Simulate linear models with confidence interval

Syntax

y = sim(m,u)
y = sim(m,u,'noise')
[y, ysd] = sim(m,u,'InitialState',init)


Description

m is any idmodel or idnlmodel object.

u is an iddata object, containing inputs only. (Any outputs are ignored). Both time-domain and frequency-domain signals are supported. The number of input channels in u must either be equal to the number of inputs of the model m or equal to the sum of the number of inputs and noise sources (number of outputs). In the latter case the last inputs in u are regarded as noise sources and a noise-corrupted simulation is obtained. The noise is scaled according to the property m.NoiseVariance in m. To obtain the right noise level according to the model, the noise inputs should be white noise with zero mean and unit covariance matrix. A simpler way of obtaining a noise-corrupted simulation with Gaussian noise is to add the argument 'noise'. If no noise sources are contained in u, a noise-free simulation is obtained. sim applies both to time-domain and frequency-domain iddata objects, but no standard deviations are obtained for frequency-domain signals.

sim returns y, containing the simulated output, as an iddata object.

init gives access to the initial states:

The second output argument ysd is the standard deviation of the simulated output. This is not available for frequency-domain data.

u can also be given as a matrix with the number of columns being either the number of inputs in m or the sum of the number of inputs and outputs. Then y and ysd are returned as matrices. Continuous-time models, however, require u to be given as iddata.

If m is a continuous-time model, it is first converted to discrete time with the sampling interval given by ue, taking into account the inter-sample behavior of the input (ue.InterSample).

Examples

Simulate a given system m0 (for example, created by idpoly).

e = iddata([],randn(500,1));
u = iddata([],idinput(500,'prbs'));
y = sim(m0,[u e]);
% iddata object with output y and input u.
z = [y u];

The same result is obtained by

u = iddata([],idinput(500,'prbs'));
y = sim(m0,u,'noise');
z = [ y u];

or

u = idinput(500,'prbs');
y = sim(m0,u,'noise');
z = iddata(y,u);

Validate a model by comparing a measured output y with one simulated using an estimated model m.

yh = sim(m,u);
plot(y,yh)

See Also

compare 
idmdlsim 
pe 
predict 
simsd 

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS