parameter tuning in matlab simulink
4 次查看(过去 30 天)
显示 更早的评论
How can enable Tuning of different parameters in Simulink
2 个评论
Rohit Kulkarni
2024-3-7
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
回答(1 个)
Gyan Vaibhav
2024-3-13
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1641111/image.png)
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!