Skip to Main Content Skip to Search
Product Documentation

frest.simCompare - Package: frest

Plot time-domain simulation of nonlinear and linear models

Syntax

frest.simCompare(simout,sys,input)
frest.simCompare(simout,sys,input,x0)
[y,t] = frest.simCompare(simout,sys,input)
[y,t,x] = frest.simCompare(simout,sys,input,x0)

Description

frest.simCompare(simout,sys,input) plots both

frest.simCompare(simout,sys,input,x0) plots the frequency response simulation output and the simulation output of the linear model with initial state x0. Because you specify the initial state, the linear simulation result is not offset by the initial output values in the simout data.

[y,t] = frest.simCompare(simout,sys,input) returns the linear simulation output response y and the time vector t for the linear model sys with the input signal input. This syntax does not display a plot. The matrix y has as many rows as time samples (length(t)) and as many columns as system outputs.

[y,t,x] = frest.simCompare(simout,sys,input,x0) also returns the state trajectory x for the linear state space model sys with initial state x0.

Examples

Compare a time-domain simulation of the Simulink watertank model and its linear model representation:

% Create input signal for simulation
input = frest.createStep('FinalTime',100);

% Open the Simulink model
watertank

% Specify the operating point for the estimation
watertank_spec = operspec('watertank');
op = findop('watertank',watertank_spec)

% Specify portion of model to estimate
io(1)=linio('watertank/PID Controller',1,'in');
io(2)=linio('watertank/Water-Tank System',1,'out');

% Estimate the frequency response of the watertank model
[sysest,simout] = frestimate('watertank',op,io,input)
sys = linearize('watertank',op,io);
frest.simCompare(simout,sys,input);

The software returns the following plot.

See Also

frest.simView | frestimate

  


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