How do I freeze a Simulation in Simulink, close MATLAB

Technical Source
2 min readOct 12, 2021

I would like to run a simulation in Simulink following the below steps:

1. Run the simulation from time 0 to 10s

2. Stop the simulation at time 10s and save all the states and operating points of the simulation at that timestep

3. Close MATLAB

4. Re-open MATLAB/Simulink and then re-run that same model starting from time 10s to 20s and starting from the operating point and states I saved at time 10s. I do not want the model to restart the simulation from time 0 and lose the final simulation state of step 1.

How can the above workflow be achieved?

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

This is an ideal application for a “ModelOperatingPoint” object. The “ModelOperatingPoint” object is a MATLAB object that stores information about the final state of the simulation at a given stop time. For this use case, that stop time is 10 seconds. You can then use the “ModelOperatingPoint” object to run the same model again but this time starting from the time-step and simulation state that was saved at 10 seconds till any new stop time you specify without losing the data that was generated during the initial run.

To get started on “ModelOperatingPoint”, please refer to the following documentation link:

https://www.mathworks.com/help/releases/R2020b/simulink/ug/saving-and-restoring-simulation-operating-point.html

Below are two scripts, executed in sequence, that should execute the above required workflow for the attached example Simulink model called “vdpOperatingPointExample.slx”. The attached model “vdpOperatingPointExample.slx” is a copy of one of the Simulink shipped examples called “vdp” that models the van der Pol equation. More resources on how to programmatically control and simulate the “vdp” shipped example can be found here:

https://www.mathworks.com/help/releases/R2020b/simulink/ug/using-the-sim-command.html

To demonstrate the use of model operating points for saving a model’s operating point and re-starting the simulation from that point, first, download the attached model: “vdpOperatingPointExample.slx”.

Then, in the same MATLAB working directory as the downloaded Simulink model, please execute the below script:

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.