Effacer les filtres
Effacer les filtres

How to run Simulink model in a loop with continuously changing one input parameter?

37 vues (au cours des 30 derniers jours)
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).

Réponses (3)

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 10 Avr 2019
% 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
Avinash Prakash le 15 Juin 2016
Modifié(e) : Avinash Prakash le 15 Juin 2016
Figured it out myself :)
y = zeros(1,5);
for i=1:5
sim('simulink_model')
y(i) = output_from_Model;
end
  1 commentaire
Amardeep Mishra
Amardeep Mishra le 23 Oct 2018
How to force the for loop to continue even when sim() returns NaN or infinity?

Connectez-vous pour commenter.


Andreas Goser
Andreas Goser le 14 Juin 2016
Most users run this through a MATLAB script and the SIM command. You can also leverage commands like SET_PARAM.
  1 commentaire
Avinash Prakash
Avinash Prakash le 14 Juin 2016
Hello Andreas,
Can you please give me an example of the MATLAB script?
Thank you so much.
- Avinash

Connectez-vous pour commenter.

Catégories

En savoir plus sur Simulink Environment Customization dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by