Is it possible to change a parameter in a Simulink model each time it is run via a for loop in a MATLAB script?

7 views (last 30 days)
I am using the battery block within Simulink to explore how battery degradation changes with age of the battery. I want to be able to run the model with a specific parameter value set (age of battery in cycles). Then I want the data that is generated to be plotted on a figure. Then, via a for loop, I want to change the variable in the simulink model. The model will run again with the new variable. Then, the new data generated will be plotted on the figures created earlier to allow for data comparison. Then, the variable for the age of the battery in cycles will change again and the whole process will repeat for at least ten different ages.
Is there any way this can be implemented within Matlab and Simulink? Thank you.

Answers (1)

Fangjun Jiang
Fangjun Jiang on 27 Feb 2023




Community Treasure Hunt

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

Start Hunting!