Running simulink model with multiple values of a parameter, and then plotting multiple results on the same plot
39 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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?
0 Commenti
Risposta accettata
Paul
il 17 Feb 2023
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.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su View and Analyze Simulation Results in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!