Problem on linear programming for the scalar reference governor.

2 次查看(过去 30 天)
Hi, need some help from those expert on the linear programming for the scalar reference governor. The following question is
where v(t) is the output of the reference governor,
r(t) is the reference input,
v(t-1) is the previous output of the reference governor
O = {(v, x): y(v, x) Y} ,y(v, x) == (CA^k)x+C(I−A) −1(I−A^k)Bv+Dv
So right now I use the matlab function block in the simulink to deal with this issue. The below is the code that I done in the matlab finction block. For the 'myfun' is a m file on the matlab and I call it from the maltab function block at the simulink. Then my problem is my code showing error ''MxArrays inside structures are not supported for code generation.'' Hope those expert at this field can give me the suggestion how my code can be corrected.
function v = SRG1( v_previous, r)
%#codegen
coder.extrinsic('fmincon');
[k.fval.exitflag]=fmincon('myfun');
v= v_previous + k*(r - v_previous);
end
%myfun is a m file
function obj=myfun(k)
obj=-k;
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by