TOOLBOX DYNOPT DINAMIC OPTIMISATION
1 回表示 (過去 30 日間)
古いコメントを表示
MATLAB Community:
Along with saying hello, I wanted to consult the error that occurred in matlab below and install the DYNOPT toolbox. I try to enter the code and it shows me that the dynopt function is not defined.
Next I will detail the code:
proceso.m
function sys = proceso (t, x, flag, u)
switch flag,
caso 0
sys = [x (2);
-x (2) + u;
x (1) ^ 2 + x (2) ^ 2 + 0.005 * u ^ 2];
caso 1
sys = [0 0 2 * x (1);
1 -1 2 * x (2);
0 0 0];
caso 2
sys = [0 1 0.01 * u];
caso 3
sys = [0 0 0];
caso 4
sys = [0; -1; 0];
de otra manera
error ([ 'unsandled flag =' , num2str (flag)]);
fin
objfun.m
function [f, Dft, Dfx, Dfu] = objfun (t, x, u)
f = x (3);
Dft = [];
Dfx = [0; 0; 1];
Dfu = [];
confun.m
function [c, ceq, Dct, Dcx, Dcu, Dceqt, Dceqx, Dcequ] = confun (t, x, u)
c = x (2) -8 * (t-0.5) ^ 2 + 0.5;
ceq = [];
Dct = [- 16 * t + 8];
Dcx = [0; 1; 0];
Dcu = [];
Dceqt = [];
Dceqx = [];
Dcequ = [];
gráfico.m
[time,state,control] = tuxprint(x,4,2,10,1,3,1000);
[tp,cp,ceqp] = tcceqprint(2,x,4,2,10,1,3,'confungrad',1000);
and what I write in the command windows is:
opt = optimset ( 'LargeScale' , 'off' , 'Display' , 'iter' );
opt = optimset (opt, 'GradObj' , 'on' , 'GradConstr' , 'on' );
opt = optimset (opt, 'TolFun' , 1e-5);
opt = optimset (opt, 'TolCon' , 1e-5);
opt = optimset (opt, 'TolX' , 1e-5);
u = [13 4 -0.5 -2 -1.8 0 0.5 2 0 0];
tiempo = 0.1 * unidades (10,1);
[x, fval, exitflag, salida] = dynopt (1,2,4,2, time, 1, u, [], [], 'objfun' , 'confun' , 'process' , opt);
The last line where dynopt exits gives me the following message: Undefined function or variable 'dynopt'.
Thanks and regards,
1 件のコメント
Geoff Hayes
2018 年 11 月 20 日
Connie - from the command line, type
which dynopt -all
to locate the dynopt function. I suspect that the DYNOPT toolbox is a third party toolbox (please correct me if I'm wrong) and has not been included in your MATLAB search path. Please add the toolbox (location) to the search path and try again.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Bartlett についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!