Skip to Main Content Skip to Search
Product Documentation

sim(idnlgrey) - Simulate nonlinear ODE model

Syntax

YS = sim(NLSYS,DATA)
YS = sim(NLSYS,DATA,'Noise');
YS = sim(NLSYS,DATA,X0INIT);
YS = sim(NLSYS,DATA,'Noise',XOINIT);
YS = sim(NLSYS,DATA,'Noise','InitialState',X0INIT);
[YS, YSD, XFINAL] = sim(NLSYS,DATA,'Noise','InitialState',X0INIT);

Description

YS = sim(NLSYS,DATA) simulates the output of an idnlgrey model.

YS = sim(NLSYS,DATA,'Noise'); simulates the model with Gaussian noise added to YS.

YS = sim(NLSYS,DATA,X0INIT); simulates the model with the specified initial states.

YS = sim(NLSYS,DATA,'Noise',XOINIT); simulates the model with the specified initial states and with Gaussian noise added.

YS = sim(NLSYS,DATA,'Noise','InitialState',X0INIT); simulates the model with the specified initial states.

[YS, YSD, XFINAL] = sim(NLSYS,DATA,'Noise','InitialState',X0INIT); performs simulation starting with the specified initial states and with Gaussian noise added, and returns the final states of the model after the simulation is completed.

To simulate the model with user-defined noise, set the input DATA = [UIN E], where UIN is the input signal and E is the noise signal. UIN and E must both be one of the following:

Input Arguments

Output Arguments

Examples

In this example you simulate an idnlgrey model for a data set z. This example uses the nlgr model created in idnlgreydemo2.

  1. Load the data set and create an idnlgrey model.

    load twotankdata;
    
  2. Estimate the idnlgrey model.

    % Specify file.
    FileName = 'twotanks_c';
    % Specify model orders [ny nu nx].
    Order = [1 1 2];
    % Specify initial parameters.
    Parameters = {0.5; 0.0035; 0.019; ...
                  9.81; 0.25; 0.016};
    % Specify initial states.
    InitialStates = [0; 0.1];
    Ts = 0;
    nlgr = idnlgrey(FileName, Order, Parameters, ...
                    InitialStates, Ts, ...
                    'Name', 'Two tanks');
    
  3. Create an iddata object z from data z (from twotankdata.mat).

    z = iddata([], u, 0.2, 'Name', 'Two tanks');
  4. Simulate the model using the input signal from the data z.

    sim(nlgr,z)

See Also

findstates(idnlgrey) | pe | pem | predict

  


Free Control Systems Interactive Kit

Learn more about resources for designing, testing, and implementing control systems.

Get free kit

Trials Available

Try the latest control systems products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS