User`s guide
Generating Data Using Simulation
% Construct input data and noise
u = iddata([],u,'Period',10);
e = iddata([],randn(1500,1));
% Simulate model output with noise
y = sim(m0,[u e])
% Estimate frequency response
g = etfe([y u])
% Generate Bode plot
bode(g,'x',m0)
For periodic input, etfe honors the p eriod a nd computes the frequency
response using an appropriate frequency grid. In this case, the Bode plot
shows a good fitatthefive excited f requencies.
Example – Generating Data Using Simulation
This example dem onstrates how you can create input data and a model, and
then use the data and the model to simulate output data. You create the
ARMAX model and simulate output data with random binary input
u.
1 Load the three-input and one-output sample data.
load iddata8
2 Construct an ARM AX model, using the following commands:
A = [1 -1. 2 0.7];
B(1,:) = [0 1 0.5 0.1]; % first input
B(2,:) = [0 1.5 -0.5 0]; % second input
B(3,:) = [0 -0.1 0.5 -0.1]; % third input
C=[10000];
Ts = 1;
m = idpoly(A,B,C,'Ts',1);
In this example, the leading zeros in the B matrix indicate the input delay
(
nk), which is 1 for each input channel. The trailing zero in B(2,:) makes
the number of coefficients equal for all channels.
3 Construct pseudorandom binary data for input to the simulation.
u = idinput([200,3],'prbs');
1-117