Main Content

compare

Compare two MPC objects

Description

yesno = compare(mpcobj1,mpcobj2) compares the contents of the two MPC objects mpcobj1 and, mpcobj2 given as input arguments. If the design specifications (models, weights, horizons, etc.) are identical, then the returned value yesno is equal to 1.

Note

compare may return yesno = 1 even if the two objects are not identical. For instance, mpcobj1 may have been initialized while mpcobj2 may have not, so that they may have different sizes in memory. In any case, if yesno = 1, the behavior of the two controllers will be identical.

example

Examples

collapse all

Create two MPC controllers with different control horizons and compare them.

plant=zpk([],2,1);              % create plant
mpcverbosity off;               % turn off MPC messaging
mpcobj1=mpc(plant,0.1,10,2);    % create an mpc controller with a control horizon of 2 steps
mpcobj2=mpc(plant,0.1,10,3);    % create an mpc controller with a control horizon of 3 steps

compare(mpcobj1,mpcobj2)        % compare the controllers

ans =
  logical
   0

Input Arguments

collapse all

First MPC object to compare

Example: mpc(tf(1,[1 0]),1,12,3)

Second MPC object to compare

Example: mpc(tf(1,[1 0]),1,12,4)

Output Arguments

collapse all

The returned value is a logical 1 (that is true) if the design specifications (models, weights, horizons, etc.) are identical.

Version History

Introduced before R2006a

See Also

Functions

Objects