I have been following the "Model Predictive Control System Design and Implementation Using MATLAB®" by Wang to understand how MPC works.
So far I have been successful with most of the applications until it involved state observers. Specifically, this example is, Example 1.9 from the book:
The augmented model for a double integrated plant (see Example 1.1) is given by
x(k + 1) = Ax(k) + BΔu(k)
y(k) = Cx(k)
Where,
A = [1 1 0; 0 1 0; 1 1 1]
B = [0.5;1;0.5]
C = [0 0 1]
It's asked to design a MPC with Nc = 5, Np = 30 & rw = 10 with a closed loop observer with poles at 0.01, 0.0105, 0.011.
Here is my answer & where I deviate from the example. I find the observer gain with following MATLAB code as expected:
Pole=[0.01 0.0105 0.011];
K_ob=place(A’,C’,Pole)’;
Kob = [1.9685 0.9688 2.9685]
However, the problem is, when I calculate the MPC gain, I calculate it using the following MATLAB code as:
Np = 30;
Nc = 5;
x0 = [0;0;0];
rw = 10;
Rs = ones(Np,1)*1;
Rbar = rw*eye(Nc,Nc);
for i = 1:Np
F(i,:) = C*A^(i);
end
Phi = zeros(Np,Nc);
for i = 1:Np
DiagEls(i,:) = C*A^(i-1)*B;
end
for i = 1:Nc
Phi(i:Np,i) = DiagEls(1:Np-i+1);
end
K_mpc = [1 zeros(1,Nc-1)]*pinv(Phi'*Phi+Rbar)*Phi'*F
I find K_mpc as [0.5495 1.0479 0.1864]
However, the example finds as [0.8984 1.3521 0.4039].
Could you help me understand where the difference is coming from? Do we calculate the MPC gains differently when there's a state observer feedback present?