Running simulink model with multiple values of a parameter, and then plotting multiple results on the same plot

39 Ansichten (letzte 30 Tage)
I have a simulink model (a DC-DC boost converter) that I can run, where there is a parameter called "Beta" that affects the step response. I have oscilloscopes connected to the output.
--> In my parent .m file, I want to run the simulink model several times. For instance:
"Open my_model.slx, set Beta to 0.5, then simulate, and plot output voltage"
"Open my_model.slx, set Beta to 0.6, then simulate, and plot output voltage on the SAME plot as above"
"Open my_model.slx, set Beta to 0.7, then simulate, and plot output voltage on the SAME plot as above"
...etc.
This way, I can see which value of Beta gives me the "best" response. I know I need the "hold on" command to keep data on the same plot. How do I output oscilloscope data from the simulink model to the workspace, so that I can plot it?

Akzeptierte Antwort

Paul
Paul am 17 Feb. 2023
Instead of, or in addtion to, the scope, send your data to a To Workspace block.
Check out this doc page for an example of how to run multiple simulations with different parameters. You can use sim instead of parsim. sim is probably easier for just three runs.
After the simulations are complete the data from all three simulations will be in the variable 'out', or whatever you call the output of the sim command. Each element of out is a Simulink.SimulationOutput object. See the doc page on how to access the simulation outputs from each element of out for plotting. Yes, plot each one separately using the hold command between plots.
Make sure the Single Simulation Output is enabled on the Model Settings -> Data Import/Export pane. It's probably enabled already by default.

Weitere Antworten (0)

Kategorien

Mehr zu View and Analyze Simulation Results finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by