www.gusucode.com > mpc 案例源码 matlab代码程序 > mpc/ExtractParametersForStateEstimationExample.m
%% Extract Parameters for State Estimation %% % The plant is a stable, discrete LTI ss model with four states, three inputs % and three outputs. The manipulated variables are inputs 1 and 2. Input % 3 is an unmeasured disturbance. Outputs 1 and 3 are measured. Output 2 % is unmeasured. % % Create a model of the plant and specify the signals for MPC. % Copyright 2015 The MathWorks, Inc. rng(1253) % For repeatable results Plant = drss(4,3,3); Plant.Ts = 0.25; Plant = setmpcsignals(Plant,'MV',[1,2],'UD',3,'MO',[1 3],'UO', 2); Plant.d(:,[1,2]) = 0; %% % The last command forces the plant to satisfy the assumption of no direct % feedthrough. % % Calculate the default Model Predictive Controller for this plant. MPCobj = mpc(Plant); %% % Obtain the parameters to be used in state estimation. [L,M,A,Cm,Bu,Bv,Dvm] = getEstimator(MPCobj); %% % Based on the estimator state equation, the the estimator poles are given % by the eigenvalues of |A - L*Cm|. Calculate and display the poles. Poles = eig(A - L*Cm) %% % Confirm that the default estimator is asymptotically stable. max(abs(Poles)) %% % This value is less than 1, so the estimator is asymptotically stable. %% % Verify that in this case, |L = A*M|. L - A*M