Main Content

d2d

Change sampling time of an MPC controller

Description

Use the Model Predictive Control Toolbox™ d2d function to change the sampling time of an MPC controller (see mpc for background).

To resample a generic discrete-time LTI dynamical system instead, see d2d.

example

newmpc = d2d(MPCobj,newTs) returns the controller newmpc, which is identical to MPCobj except for the new sample time newTs. This is equivalent to coying MPCobj in a new object newmpc and assigning a new sample using either newmpc.Ts=newTs or set(newmpc,'Ts',newTs). All models in newmpc are sampled or resampled when the QP matrices must be computed, for example when sim or mpcmove are called.

Examples

collapse all

Create a plant, a corresponding MPC object, and create a new controller with a different sampling time.

mpcverbosity off;                           % turn off mpc messaging
plant=tf(1,[1 1]);                          % create plant (note the steady state gain)
mpcobj=mpc(plant,1);                        % create mpc object (1 second sampling time)

newmpc=d2d(mpcobj,0.2);                     % change sampling time to 0.2 seconds
newmpc.Ts
ans =
    0.2000

newmpc.Ts=1;                                % change sampling time back to 1 second
compare(newmpc,mpcobj)                      % compare the two controllers
ans =
  logical
   1

Input Arguments

collapse all

Model predictive controller, specified as an MPC controller object. To create an MPC controller, use mpc.

This is the new sampling time for the returned, resampled, MPC controller mpcobjTs.

Example: 0.2

Output Arguments

collapse all

This is the returned MPC controller, which is identical to MPCobj except for the fact that its sampling time is now newTs. The internal models of newmpc are sampled or resampled when the QP matrices must be computed for the MPC optimization problem to be solved.(for example when sim or mpcmove are called).

See Also

|

Introduced before R2006a