This sequel to Numerical Computing with MATLAB explores the mathematics of simulation.
% This m-file creates the root locus for the Lorenz Chaos model.
% It requires data that is generated when you run the model
% Lorenz_2.mdl that is in this directory. The model generates
% a set of linear models that are stored in MATLAB structures.
% The A-matrix for the ith linearized state-space model is:
% We creater a structure in MATLAB called Lorenz.eig. Lorenz is a 40 by 1
% structure with the substructure eig a 3 vector that has the three
% eigenvalues at each of the time points represented by i. In the
% simulaiton of the Lorenz attractor, the linear models were created every
% 1/50 of a second, so Lorenz_2_Trigger_Based_Linearization_(i).a is of
% dimension 1000. We calculate the eigenvalues for every 50th of these,
% so the eignevalues are for the linear models created every 1 second.
% You can change this by changing the number 50 in the for loop. You can
% also go back to the model and change the Pulse Generator block times for
% the Trigger Based Linearization block to chnage the number of linear
% models that are created.
% Note -- Every time you run the Lorenz_2 model, a different set of initial
% conditions is used, so the resulting eigenvalues will be different.
axis([-25 15 -25 25]);
nlins = tstop/0.01;
for i = 1:nlins/50