Response optimization (Defining independent parameters)
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Alec Stothert
2012-1-11
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 个评论
Alec Stothert
2012-1-12
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
2012-1-14
1 个评论
Marcel Clementino
2012-2-22
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!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Parameter Estimation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!