Clear Filters
Clear Filters

Problem on linear programming for the scalar reference governor.

1 view (last 30 days)
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

Answers (0)

Categories

Find more on Event Functions in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!