open_system('vdpOperatingPointExample') %open the Simulink model %make sure the initial state of the model is set to default empty set_param('vdpOperatingPointExample','InitialState','[]') %enable the option of saving the last simulation operating point set_param('vdpOperatingPointExample','SaveFinalState','on','FinalStateName',... 'myOperPoint','SaveOperatingPoint','on'); %run the simulation for 10 seconds % because the last state at time equal to 10 seconds will be saved simOut = sim('vdpOperatingPointExample','StopTime','10') % when a Simulink model completes its simulation % it will save the output in a structure by default called "simOut". % Below, the operating point called "myOperPoint" is being extracted % and saved locally in the MATLAB base workspace myOperPoint = simOut.myOperPoint % Save the operating point that was extracted (the one at time 10) % inside a MAT-file called "data.mat" to be able to close MATLAB % and not lose the data save('data','myOperPoint') save_system('vdpOperatingPointExample') %save changes to model
Now you can close MATLAB and then execute the below script to extract the saved operating point and then start the simulation from time 10s:
open_system('vdpOperatingPointExample') %{ The below command is optional. It was added it just to point out that you probably would want to turn off the option of saving the final operating point because we don't need it anymore and we don't want it to interfere with the original operating point %} % disable the option of saving the last operating point set_param('vdpOperatingPointExample','SaveFinalState','off',... 'SaveOperatingPoint','off'); %%%%%%%%%%%%%%% % The below is mandatory % load the operating point we saved in the data.mat MAT-file load data % set the initial state of the system to be the operating point % last saved in the last simulation set_param('vdpOperatingPointExample','LoadInitialState','on','InitialState',... 'myOperPoint'); % execute the simulation for stop time 20 seconds now % it should start from t = 10s sim('vdpOperatingPointExample','StopTime','20') %reset initial state to default empty when sim is over set_param('vdpOperatingPointExample','InitialState','[]')
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.