Run Simulink repeatedly from Matlab
조회 수: 11 (최근 30일)
이전 댓글 표시
I am going to be running a simulation repeatedly varying a few parameters.
I will have to do hundreds of iterations. I do not want to compile every time. My Simulink contains external calls. Currently, the parameters that I will vary are put in the workspace by an initialization script.
What is the best practice for running simulations using Simulink repeatedly when modifying parameters from Matlab?
댓글 수: 0
채택된 답변
Sebastian Castro
2017년 7월 18일
The best approach is to use Fast Restart simulation: https://www.mathworks.com/help/simulink/ug/fast-restart-workflow.html
Fast restart will let you run simulations repeatedly without recompiling, as long as the variables you're changing do not affect the model in any way. For example, you can change tunable parameters, inputs, etc. but not structural things such as sample times, data types, dimensions, etc.
To do this from the command line, you can just do:
for idx = 1:100
myParams = externalFunction(idx);
simout = sim('modelName','FastRestart','on');
end
- Sebastian
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Event Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!