This simulink presents how to implement differential equations and visualize the results in a MATLAB plot. The approach is to represent the equations using Simulink blocks and then use MATLAB graphics to plot the results. The advantage of using the graphical approach is with the ability to customize the solver configurations and step through the solution in time.
The design pattern shows a two stage model in which the integrator plays the role of integrating the ODE. The terms are collected and fed into this integrator. Here we used vector processing capabilities of the integrator to process the three terms simultaneously. The concept of feedback is important as the solver solves for the next step in the simulation based on its current states.
We use MATLAB S-Functions to incorporate visualization code for the MATLAB GUI. Also, observe that we move the camera around so that you get a good visual of how the 3D curve looks like. There is also a model that uses a Level-1 S-function for those who may be interested in it for legacy reasons. Look into the MATLAB S-Function code as to how a red marker that acts like a tracer is created. The S-Function block was modeled as a discrete block with a sampling time so that a high fidelity plot could be obtained(at the cost of performance). There is a performance trade-off that you should look out for when visualizing results. Look into the code for the various S-Functions and read the comments to understand how the code is structured.
Notes on the Lorenz Attractor:
The study of strange attractors began with the publication by E. N. Lorenz- ‘Deterministic non-periodic flow'(Journal of Atmospheric Science, 20:130-141, 1963). In the process of investigating meteorological models, Edward Lorenz found that very small truncation or rounding errors in his algorithms produced large changes in the resulting predictions. This led to the study of ‘strange’ or chaotic attractors.
One crude way to visualize attractors is a set such that if during the evolution of the dynamics of the system, one of the states hits a point in that set, it will continue to remain in that set. From a simulation point of view, it is interesting to see the existence of such sets for certain nonlinear dynamical systems. If this attractor is chaotic meaning it has sensitive dependence on initial conditions, then it is called a strange attractor.
It was particularly an interesting result which he observed that for parameter values sigma=10, beta=8/3, and rho=28, the solutions start revolving about two repelling equilibirum points at (sqrt(72), sqrt(72.27). The number of times the solution revolves around one equilibirum point before switching to the other has no discernible pattern. More information on this can be obtained in a standard introductory nonlinear systems text.