parameter tuning in matlab simulink
4 views (last 30 days)
Show older comments
How can enable Tuning of different parameters in Simulink
2 Comments
Rohit Kulkarni
on 7 Mar 2024
Hi Maya.
In my understanding you want to tune parameters of your Simulink model to evaluate your model and check edge cases.
To enable this you can change the block parameters via the block parameter dialog box, Dashboard blocks and MATLAB language. You can also create tunable global parameters by using MATLAB variables as value expressions.
Refer to the following documentation for examples:
Thanks
Answers (1)
Gyan Vaibhav
on 13 Mar 2024
Hi Maya,
For tuning parameters you need to determine and make sure a few things, such as is your parameter tunable, if yes your simulation must take enough time to simulate for you to change the values of your tunable parameters.
I have made a very simplistic model of summation of a sine wave with a constant block, similar to the example you requested.
- You can use workspace variables or Simulink Parameters objects to set block parameter values to be tuned.To access the value of a block parameter, such as the Constant value parameter of a Constant block, you must navigate to the block in the model and open the block dialog box, search for the block by using the Model Explorer, or use the function set_param at the command prompt.
- To observe simulation output in real time while you tune block parameter values, you can use blocks in a model such as the Scope block.
- A simulation run can execute so quickly that you cannot tune block parameter values. Also, if you want to change a parameter value at a specific simulation time, you must learn to control the simulation pace. You can configure the simulation to run for a specific duration or to run forever, and pause and advance the simulation when you want to. Or you can stop it at a certain time and then go on stepping. (You can stop simulation by configuring in the scope options).
- If you set the block parameter value by creating a workspace variable, you can change the value of the variable by using the command prompt, the MATLAB Workspace browser, or the Model Explorer. You can also create a variable to set the same value for multiple block parameters. When you change the variable value, all of the target block parameters use the new value.
- In R2017a, you need to click Update Diagram (Simulation > Update Diagram) after every change in the variable to take effect. (Refresh Blocks works too but is greyed out when the simulation is paused).
Below is a sample screenshot from the output of the model, when I tuned it in real time.
I highly recommend you to go through this documentation to learn how parameters can be tuned in detail: https://www.mathworks.com/help/simulink/ug/using-tunable-parameters.html
Hope this helps.
Thanks
Gyan
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!