How to extract elements from a Simscape electrical simulation and run a batched parameter sweep?

3 views (last 30 days)
An Uh
An Uh on 10 Jun 2020
Answered: David John on 6 Dec 2021
I'd like to ask for help with the following idea (feasability and maybe hints as to how to do it):
I would like to be able to do the following:
1.Take any Simscape Electrical model and return a list of elements (resistors, diodes etc.).
2.Run and record the simulation output.
3.Change a parameter of an element and run the same simulation and record results (basically performing a sweep of element parameters)
4.Compare the outputs and categorize the elements according to the impact on the simulation output.
Ideally I would end up with a script that does this automatically for any Simscape simulation without custom blocks.
Does this sound doable in any way? If so what resources are there to make it happen? (I guess I'd need to setup a batching script that filters elements by type, predefine parameters to be changed etc.)
Thank you in advance

Answers (1)

David John
David John on 6 Dec 2021
Yes, this is possible. There is an example that illustrates a few of the steps you've highlighted above at Tolerance Study Using Monte Carlo Simulations in Resonant LLC DC-DC Converter - MATLAB & Simulink ( In there, you can see how to log data, run simulations, set parameters and make comparisons and plots. I think this one should cover most of steps (2)-(4). For (1), you can use find_system to get all of the blocks of particular types from your model.

Community Treasure Hunt

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

Start Hunting!

Translated by