How to run Simulink model in a loop with continuously changing one input parameter?
Show older comments
I have built a Simulink model and it's inputs are given from scripts. Say suppose my input is "x" and output is "y", I have to simulate the model for different input values (x) and get corresponding outputs (y).
Answers (3)
Sulaymon Eshkabilov
on 10 Apr 2019
2 votes
% Simulink won't run if the result comes to inf or NaN.
% A bit more complete answer of this problem:
y = cell(zeros(1,5));
for ii=1:5
OUT = sim('simulink_model.slx');
y{ii} = OUT;
end
Avinash Prakash
on 15 Jun 2016
Edited: Avinash Prakash
on 15 Jun 2016
1 Comment
Amardeep Mishra
on 23 Oct 2018
How to force the for loop to continue even when sim() returns NaN or infinity?
Andreas Goser
on 14 Jun 2016
0 votes
Most users run this through a MATLAB script and the SIM command. You can also leverage commands like SET_PARAM.
1 Comment
Avinash Prakash
on 14 Jun 2016
Categories
Find more on Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!