Hi ,recently i have develop the scalar reference governor in the simulink by using the matlab function block.Therefore, I have done my to develop the code, but there is a problem where the output of the system is not really track back the reference and have some undershoot. So I want ask some help how to improve this code or modified this code to make the output of the system become better. This is my output graph and the simulinik file is attached as follow
the red line is the output and the green line is the reference input.
hope to get some help, thx
function v = SRG_new(v_previous, r)
A=[-21.22 1;-275.5 0];
if (S*C*A^i)+ S*(C*(I-A^i)*((I-A)^-1)*B+D)>s
v=v_previous + k*(r-v_previous);