Problem on linear programming for the scalar reference governor.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, need some help from those expert on the linear programming for the scalar reference governor. The following question is
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/595295/image.png)
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Event Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!