www.gusucode.com > mpc 案例源码 matlab代码程序 > mpc/ConstructOutputDisturbanceModelUsingTransferFunctionsExample.m
%% Specify Output Disturbance Model Using Transfer Functions % Define a plant model with no direct feedthrough, and create an MPC controller % for that plant. plant = rss(3,3,3); plant.D = 0; MPCobj = mpc(plant,0.1); %% % Define disturbance models for each output such that the output disturbance % for: % % * Channel 1 is random white noise with a magnitude of |2|. % * Channel 2 is random step-like noise with a magnitude of |0.5|. % * Channel 3 is random ramp-like noise with a magnitude of |1|. mod1 = tf(2,1); mod2 = tf(0.5,[1 0]); mod3 = tf(1,[1 0 0]); %% % Construct the output disturbance model using these transfer functions. % Use a separate noise input for each output disturbance. outdist = [mod1 0 0; 0 mod2 0; 0 0 mod3]; %% % Set the output disturbance model in the MPC controller. setoutdist(MPCobj,'model',outdist) %% % View the controller output disturbance model. getoutdist(MPCobj) %% % The controller converts the continuous-time transfer function model, % |outdist|, into a discrete-time state-space model.