Response optimization (Defining independent parameters)
2 views (last 30 days)
Show older comments
My aim is to optimize independent variables like the example depicted in user guide of the Simulink Design Optimization Toolbox ( check Specify Independent Parameters to Estimate (GUI) in http://www.mathworks.com/help/toolbox/sldo/ug/brzompd_1.html ).
I tried the same example, but I could not add x and y variables as tuning parameters? What could be wrong in the example?
wks = get_param(gcs, 'ModelWorkspace')
x = wks.evalin('x')
y = wks.evalin('y')
Kint = x+y;
I think, second line of the above code is not working?
Regards,
Ismail
0 Comments
Answers (2)
Alec Stothert
on 11 Jan 2012
The tool detects tuning parameters by determining what variables are used by the model. In this case the tool cannot detetct that x and y are used by the model (they dont appear in any block masks).
The easiest fix is to add a block to the model that uses x and y, the block doesn’t need to influence the model computation it just needs to be there so that the variables are “used” by the model, for example add a constant block with a terminator.
2 Comments
Alec Stothert
on 12 Jan 2012
Remove 'srotut1_start' from the model StartFcn and put it in the model InitFcn. The InitFcn runs before compilation has started and should avoid the error you mention.
This coupled with the earlier trick should allow you to optimize independent variables.
Ismail Delice
on 14 Jan 2012
1 Comment
Marcel Clementino
on 22 Feb 2012
Hi,
I've tried this, but I didn't get the expected results.
When I do what you said, it shows an error message saying that my independent variable is undefined.
If I create the variable in the ModelWorkspace, I can run the simulation, but this variable doesn't change along the optimization process. I don't know what I am doing wrong. This are the steps that I followed when I could ran the simulation:
1- add a constant block;
2- write the function name (after defining it) in the Model Properties\InitialFnc*.
The function contains:
wks = get_param(gcs, 'ModelWorkspace');
Lb = wks.evalin('Lb');
3-add this variable as design variable at the Simulink Optimization Variable.
Hope you can help me!
Thanks for this post, it helped me a lot!
See Also
Categories
Find more on Parameter Estimation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!