# setoutdist

Modify unmeasured output disturbance model

## Description

`setoutdist(`

sets
the output disturbance model to its default value. Use this syntax
if you previously set a custom output disturbance model and you want
to change back to the default model. For more information on the default
output disturbance model, see MPC Prediction Models.`MPCobj`

,'integrators')

## Examples

### 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);

-->The "PredictionHorizon" property is empty. Assuming default 10. -->The "ControlHorizon" property is empty. Assuming default 2. -->The "Weights.ManipulatedVariables" property is empty. Assuming default 0.00000. -->The "Weights.ManipulatedVariablesRate" property is empty. Assuming default 0.10000. -->The "Weights.OutputVariables" property is empty. Assuming default 1.00000.

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)

ans = A = x1 x2 x3 x1 1 0 0 x2 0 1 0 x3 0 0.1 1 B = Noise#1 Noise#2 Noise#3 x1 0 0.05 0 x2 0 0 0.1 x3 0 0 0.005 C = x1 x2 x3 MO1 0 0 0 MO2 1 0 0 MO3 0 0 1 D = Noise#1 Noise#2 Noise#3 MO1 2 0 0 MO2 0 0 0 MO3 0 0 0 Sample time: 0.1 seconds Discrete-time state-space model.

The controller converts the continuous-time transfer function model, `outdist`

, into a discrete-time state-space model.

### Remove Output Disturbance from Particular Output Channel

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);

-->The "PredictionHorizon" property is empty. Assuming default 10. -->The "ControlHorizon" property is empty. Assuming default 2. -->The "Weights.ManipulatedVariables" property is empty. Assuming default 0.00000. -->The "Weights.ManipulatedVariablesRate" property is empty. Assuming default 0.10000. -->The "Weights.OutputVariables" property is empty. Assuming default 1.00000.

Retrieve the default output disturbance model from the controller.

distMod = getoutdist(MPCobj);

-->Converting model to discrete time. -->Assuming output disturbance added to measured output channel #1 is integrated white noise. -->Assuming output disturbance added to measured output channel #2 is integrated white noise. -->Assuming output disturbance added to measured output channel #3 is integrated white noise. -->The "Model.Noise" property is empty. Assuming white noise on each measured output.

Remove the integrator from the second output channel. Construct the new output disturbance model by removing the second input channel and setting the effect on the second output by the other two inputs to zero.

```
distMod = sminreal([distMod(1,1) distMod(1,3); 0 0; distMod(3,1) distMod(3,3)]);
setoutdist(MPCobj,'model',distMod)
```

When removing an integrator from the output disturbance model in this way, use `sminreal`

to make the custom model structurally minimal.

View the output disturbance model.

tf(getoutdist(MPCobj))

ans = From input "Noise#1" to output... 0.1 MO1: ----- z - 1 MO2: 0 MO3: 0 From input "Noise#2" to output... MO1: 0 MO2: 0 0.1 MO3: ----- z - 1 Sample time: 0.1 seconds Discrete-time transfer function.

The integrator has been removed from the second channel. The disturbance models for channels `1`

and `3`

remain at their default values as discrete-time integrators.

### Remove Output Disturbances from All Output Channels

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,1);

-->The "PredictionHorizon" property is empty. Assuming default 10. -->The "ControlHorizon" property is empty. Assuming default 2. -->The "Weights.ManipulatedVariables" property is empty. Assuming default 0.00000. -->The "Weights.ManipulatedVariablesRate" property is empty. Assuming default 0.10000. -->The "Weights.OutputVariables" property is empty. Assuming default 1.00000.

Set the output disturbance model to zero for all three output channels.

`setoutdist(MPCobj,'model',tf(zeros(3,1)))`

View the output disturbance model.

getoutdist(MPCobj)

ans = D = Noise#1 MO1 0 MO2 0 MO3 0 Static gain.

A static gain of `0`

for all output channels indicates that the output disturbances were removed.

### Set Output Disturbance Model to Default Value

Define a plant model with no direct feedthrough and create an MPC controller for that plant.

plant = rss(2,2,2); plant.D = 0; MPCobj = mpc(plant,0.1);

Remove the output disturbances for all channels.

`setoutdist(MPCobj,'model',tf(zeros(2,1)))`

Restore the default output disturbance model.

`setoutdist(MPCobj,'integrators')`

## Input Arguments

`MPCobj`

— Model predictive controller

MPC controller object

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

.

`model`

— Custom output disturbance model

`[]`

(default) | `ss`

object | `tf`

object | `zpk`

object

Custom output disturbance model, specified as a state-space
(`ss`

), transfer function (`tf`

), or zero-pole-gain (`zpk`

) model. The MPC controller converts
the model to a discrete-time, delay-free, state-space model. Omitting `model`

or
specifying `model`

as `[]`

is
equivalent to using `setoutdist(MPCobj,'integrators')`

.

The output disturbance model has:

Unit-variance white noise input signals. For custom output disturbance models, the number of inputs is your choice.

*n*outputs, where_{y}*n*is the number of plant outputs defined in_{y}`MPCobj.Model.Plant`

. Each disturbance model output is added to the corresponding plant output.

This model, along with the input disturbance model (if any), governs how well the controller compensates for unmeasured disturbances and modeling errors. For more information on the disturbance modeling in MPC and about the model used during state estimation, see MPC Prediction Models and Controller State Estimation.

`setoutdist`

does not check custom output
disturbance models for violations of state observability. This check
is performed later in the MPC design process when the internal state
estimator is constructed using commands such as `sim`

or `mpcmove`

. If the controller states are not
fully observable, these commands will generate an error.

## Tips

To view the current output disturbance model, use the

`getoutdist`

command.

## Version History

**Introduced in R2006a**

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

# Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)