Response optimization (Defining independent parameters)
3 ビュー (過去 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!