1
votes

I would like to optimize output signals, by tuning some of the input parameters with ease (preferably in real-time) by looping the simulation of the model again and again at a speed where the speed of simulation can be controlled.

2

2 Answers

1
votes

You have various options as far as I can see.

The first one is to have the parameters of interest defined as workspace variables, and then write a MATLAB script looping over those variables, with the use of the sim command to run the Simulink model programmatically. You can control the "speed" of the simulations with things such as step size used by the solver. If you want to combine this with optimizing parameters, you can put the call to sim in a cost function, and then pass this to the optimization routine.

The second option is to use an add-on product called Simulink Design Optimization, which provides a nice interface and uses optimization routines under the hood to loop over the parameters. This requires the Optimization Toolbox.

-1
votes

If you want to invest nothing in the creation of your user interface, you might want to use cell evaluation. Check out this link.

Increment Values in Code Sections

You can increment numbers within a section, rerunning that section after every change. This helps you fine-tune and experiment with your code.

To increment or decrement a number in a section:

Highlight or place your cursor next to the number. Right-click to open the context menu. Select Increment Value and Run Section. A small dialog box appears.

Input appropriate values in the / text box or / text box. Click the , , , or button to add to, subtract from, multiply, or divide the selected number in your section. MATLAB runs the section after every click.