# pidstd

PID controller in standard form

## Description

Use `pidstd`

to create standard-form PID controller objects, or
to convert dynamic system models to
standard PID controller form.

The `pidstd`

controller model object can represent standard-form PID
controllers in continuous time or discrete time.

Continuous time — $$C={K}_{p}\left(1+\frac{1}{{T}_{i}}\frac{1}{s}+\frac{{T}_{d}s}{\frac{{T}_{d}}{N}s+1}\right)$$

Discrete time — $$C={K}_{p}\left(1+\frac{1}{{T}_{i}}IF\left(z\right)+\frac{{T}_{d}}{\frac{{T}_{d}}{N}+DF\left(z\right)}\right)$$

Here:

*K*is the proportional gain._{p}*T*is the integral time._{i}*T*is the derivative time._{d}*N*is the first-order derivative filter divisor.*IF*(*z*) is the integrator method for computing integral in discrete-time controller.*DF*(*z*) is the integrator method for computing derivative filter in discrete-time controller.

You can then combine this object with other components of a control architecture, such as the plant, actuators, and sensors to represent your control system. For more information, see Control System Modeling with Model Objects.

You can create a PID controller model object by either specifying the controller
parameters directly, or by converting a model of another type (such as a transfer function
model `tf`

) to PID controller form.

You can also use `pidstd`

to create generalized state-space (`genss`

) models or uncertain state-space (`uss`

(Robust Control Toolbox)) models.

## Creation

You can obtain `pidstd`

controller models in one of the following
ways.

Create a model using the

`pidstd`

function.Use

`pidtune`

function to tune PID controller for a plant model. Specify a baseline standard-form PID controller type using the`C0`

argument of the`pidtune`

function. For example:sys = zpk([],[-1 -1 -1],1); C0 = pidstd(1,1,1); C = pidtune(sys,C0)

Interactively tune PID controller for a plant model using:

The

**Tune PID Controller**Live Editor task.The

**PID Tuner**app.

### Syntax

### Description

creates a continuous-time standard-form PID controller model and sets the properties
`C`

= pidstd(`Kp`

,`Ti`

,`Td`

,`N`

)`Kp`

, `Ti`

, `Td`

, and
`N`

. The remaining properties have default values.

creates a continuous-time proportional (P) controller.`C`

= pidstd(`Kp`

)

creates a proportional and integral (PI) controller.`C`

= pidstd(`Kp`

,`Ti`

)

creates a proportional, integral, and derivative (PID) controller.`C`

= pidstd(`Kp`

,`Ti`

,`Td`

)

### Input Arguments

`sys`

— Proportional gain

dynamic system model | model array

Dynamic system, specified as a SISO dynamic system model or array of SISO dynamic system models. Dynamic systems that you can use include:

Continuous-time or discrete-time numeric LTI models, such as

`tf`

,`zpk`

,`ss`

, or`pid`

models.Generalized or uncertain LTI models such as

`genss`

or`uss`

(Robust Control Toolbox) models. (Using uncertain models requires Robust Control Toolbox™ software.)The resulting PID controller assumes

current values of the tunable components for tunable control design blocks.

nominal model values for uncertain control design blocks.

Identified LTI models, such as

`idtf`

(System Identification Toolbox),`idss`

(System Identification Toolbox),`idproc`

(System Identification Toolbox),`idpoly`

(System Identification Toolbox), and`idgrey`

(System Identification Toolbox) models. (Using identified models requires System Identification Toolbox™ software.)

### Output Arguments

`C`

— Standard-form PID controller model

`pidstd`

model object | `genss`

model object | `uss`

model object

PID controller model, returned as:

A standard-form PID controller (

`pidstd`

) model object, when all the gains have numeric values. When the gains are numeric arrays,`C`

is an array of`pidstd`

controller objects.A generalized state-space model (

`genss`

) object, when the`numerator`

or`denominator`

input arguments includes tunable parameters, such as`realp`

parameters or generalized matrices (`genmat`

).An uncertain state-space model (

`uss`

) object, when the`numerator`

or`denominator`

input arguments includes uncertain parameters. Using uncertain models requires Robust Control Toolbox software.

## Properties

`Kp`

— Proportional gain

`1`

(default) | scalar | vector | matrix | `realp`

object

Proportional gain, specified as a real and finite value or a tunable object.

To create a

`pidstd`

controller object, use a real and finite scalar value.To create an array of

`pidstd`

controller objects, use an array of real and finite values.To create a tunable controller model, use a tunable parameter (

`realp`

) or generalized matrix (`genmat`

).To create a tunable gain-scheduled controller model, use a tunable surface created using

`tunableSurface`

.

`Ti`

— Integral time

`Inf`

(default) | scalar | vector | matrix | `realp`

object

Integral time, specified as a real and positive value or a tunable object.

To create a

`pidstd`

controller object, use a real and positive scalar value.To create an array of

`pidstd`

controller objects, use an array of real and positive values.To create a tunable controller model, use a tunable parameter (

`realp`

) or generalized matrix (`genmat`

).To create a tunable gain-scheduled controller model, use a tunable surface created using

`tunableSurface`

.

`Td`

— Derivative time

`0`

(default) | scalar | vector | matrix | `realp`

object

Derivative time, specified as a real, finite, and nonnegative value or a tunable object.

To create a

`pidstd`

controller object, use a real, finite, and nonnegative scalar value.To create an array of

`pidstd`

controller objects, use an array of real, finite, and nonnegative values.To create a tunable controller model, use a tunable parameter (

`realp`

) or generalized matrix (`genmat`

).To create a tunable gain-scheduled controller model, use a tunable surface created using

`tunableSurface`

.

`N`

— Derivative filter divisor

`Inf`

(default) | scalar | vector | matrix | `realp`

object

First-order derivative filter divisor, specified as a real and positive value or a tunable object.

To create a

`pidstd`

controller object, use a real and positive scalar value.To create an array of

`pidstd`

controller objects, use an array if real and positive values.`realp`

) or generalized matrix (`genmat`

).`tunableSurface`

.

When `N`

= `Inf`

, the controller has no filter
on the derivative action.

`IFormula`

— Method for computing integral in discrete-time controller

`'ForwardEuler'`

(default) | `'BackwardEuler'`

| `'Trapezoidal'`

Discrete integrator formula *IF*(*z*) for the
integrator of the discrete-time `pidstd`

controller:

$$C={K}_{p}\left(1+\frac{1}{{T}_{i}}IF\left(z\right)+\frac{{T}_{d}}{\frac{{T}_{d}}{N}+DF\left(z\right)}\right).$$

Specify `IFormula`

as one of the following:

`'ForwardEuler'`

—*IF*(*z*) = $$\frac{{T}_{s}}{z-1}.$$This formula is best for small sample time, where the Nyquist limit is large compared to the bandwidth of the controller. For larger sample time, the

`ForwardEuler`

formula can result in instability, even when discretizing a system that is stable in continuous time.`'BackwardEuler'`

—*IF*(*z*) = $$\frac{{T}_{s}z}{z-1}.$$An advantage of the

`BackwardEuler`

formula is that discretizing a stable continuous-time system using this formula always yields a stable discrete-time result.`'Trapezoidal'`

—*IF*(*z*) = $$\frac{{T}_{s}}{2}\frac{z+1}{z-1}.$$An advantage of the

`Trapezoidal`

formula is that discretizing a stable continuous-time system using this formula always yields a stable discrete-time result. Of all available integration formulas, the`Trapezoidal`

formula yields the closest match between frequency-domain properties of the discretized system and the corresponding continuous-time system.

When `C`

is a continuous-time controller,
`IFormula`

is `''`

.

`DFormula`

— Method for computing derivative in discrete-time controller

`'ForwardEuler'`

(default) | `'BackwardEuler'`

| `'Trapezoidal'`

Discrete integrator formula *DF*(*z*) for the
derivative filter of the discrete-time `pidstd`

controller:

$$C={K}_{p}\left(1+\frac{1}{{T}_{i}}IF\left(z\right)+\frac{{T}_{d}}{\frac{{T}_{d}}{N}+DF\left(z\right)}\right).$$

Specify `DFormula`

as one of the following:

`'ForwardEuler'`

—*DF*(*z*) = $$\frac{{T}_{s}}{z-1}.$$This formula is best for small sample time, where the Nyquist limit is large compared to the bandwidth of the controller. For larger sample time, the

`ForwardEuler`

formula can result in instability, even when discretizing a system that is stable in continuous time.`'BackwardEuler'`

—*DF*(*z*) = $$\frac{{T}_{s}z}{z-1}.$$An advantage of the

`BackwardEuler`

formula is that discretizing a stable continuous-time system using this formula always yields a stable discrete-time result.`'Trapezoidal'`

—*DF*(*z*) = $$\frac{{T}_{s}}{2}\frac{z+1}{z-1}.$$An advantage of the

`Trapezoidal`

formula is that discretizing a stable continuous-time system using this formula always yields a stable discrete-time result. Of all available integration formulas, the`Trapezoidal`

formula yields the closest match between frequency-domain properties of the discretized system and the corresponding continuous-time system.The

`Trapezoidal`

value for`DFormula`

is not available for a`pidstd`

controller with no derivative filter (`N = Inf`

).

When `C`

is a continuous-time controller,
`DFormula`

is `''`

.

`InputDelay`

— Input delay

0 (default)

This property is read-only.

Time delay on the system input. `InputDelay`

is always 0 for a
`pidstd`

controller object.

`OutputDelay`

— Output delay

0 (default)

This property is read-only.

Time delay on the system output. `OutputDelay`

is always 0 for a
`pidstd`

controller object.

`Ts`

— Sample time

`0`

(default) | positive scalar

Sample time, specified as:

`0`

for continuous-time systems.A positive scalar representing the sampling period of a discrete-time system. Specify

`Ts`

in the time unit specified by the`TimeUnit`

property.

PID controller models do not support unspecified sample time (```
Ts =
-1
```

).

**Note**

Changing `Ts`

does not discretize or resample the model. To
convert between continuous-time and discrete-time representations, use `c2d`

and `d2c`

. To change the sample time of a
discrete-time system, use `d2d`

.

The discrete integrator formulas of the discretized controller depend upon the
`c2d`

discretization method you use, as shown in this table.

`c2d` Discretization Method | `IFormula` | `DFormula` |
---|---|---|

`'zoh'` | `ForwardEuler` | `ForwardEuler` |

`'foh'` | `Trapezoidal` | `Trapezoidal` |

`'tustin'` | `Trapezoidal` | `Trapezoidal` |

`'impulse'` | `ForwardEuler` | `ForwardEuler` |

`'matched'` | `ForwardEuler` | `ForwardEuler` |

For more information about `c2d`

discretization methods, see
`c2d`

.

If you require different discrete integrator formulas, you can discretize the
controller by directly setting `Ts`

, `IFormula`

, and
`DFormula`

to the desired values. However, this method does not
compute new gain and filter-constant values for the discretized controller. Therefore,
this method might yield a poorer match between the continuous-time and discrete-time PID
controllers than using `c2d`

.

`TimeUnit`

— Time variable units

`'seconds'`

(default) | `'nanoseconds'`

| `'microseconds'`

| `'milliseconds'`

| `'minutes'`

| `'hours'`

| `'days'`

| `'weeks'`

| `'months'`

| `'years'`

| ...

Time variable units, specified as one of the following:

`'nanoseconds'`

`'microseconds'`

`'milliseconds'`

`'seconds'`

`'minutes'`

`'hours'`

`'days'`

`'weeks'`

`'months'`

`'years'`

Changing `TimeUnit`

has no effect on other properties, but changes the overall system behavior. Use `chgTimeUnit`

to convert between time units without modifying system behavior.

`InputName`

— Input channel names

'' (default) | character vector

Input channel name, specified as one of the following:

A character vector.

`''`

, no name specified.

Alternatively, assign the name `error`

to the input of a controller
model `C`

as follows.

`C.InputName = 'error';`

You can use the shorthand notation `u`

to refer to the
`InputName`

property. For example, `C.u`

is
equivalent to `C.InputName`

.

Use `InputName`

to:

Identify channels on model display and plots.

Specify connection points when interconnecting models.

`InputUnit`

— Input channel units

`''`

(default) | character vector

Input channel units, specified as one of the following:

A character vector.

`''`

, no units specified.

Use `InputUnit`

to specify input signal units.
`InputUnit`

has no effect on system behavior.

For example, assign the concentration units `'mol/m^3'`

to the
input of a controller model `C`

as follows.

`C.InputUnit = 'mol/m^3';`

`InputGroup`

— Input channel groups

structure

Input channel groups. This property is not needed for PID controller models.

By default, `InputGroup`

is a structure with no fields.

`OutputName`

— Output channel names

`''`

(default) | character vector

Output channel name, specified as one of the following:

A character vector.

`''`

, no name specified.

For example, assign the name `'control'`

to the output of a
controller model `C`

as follows.

`C.OutputName = 'control';`

You can also use the shorthand notation `y`

to refer to the
`OutputName`

property. For example, `C.y`

is
equivalent to `C.OutputName`

.

Use `OutputName`

to:

Identify channels on model display and plots.

Specify connection points when interconnecting models.

`OutputUnit`

— Output channel units

`''`

(default) | character vector

Output channel units, specified as one of the following:

A character vector.

`''`

, no units specified.

Use `OutputUnit`

to specify output signal units.
`OutputUnit`

has no effect on system behavior.

For example, assign the unit `'volts'`

to the output of a
controller model `C`

as follows.

`C.OutputUnit = 'volts';`

`OutputGroup`

— Output channel groups

structure

Output channel groups. This property is not needed for PID controller models.

By default, `OutputGroup`

is a structure with no fields.

`Notes`

— User-specified text

`{}`

(default) | character vector | cell array of character vectors

User-specified text that you want to associate with the system, specified as a character vector or cell array of character vectors. For example, `'System is MIMO'`

.

`UserData`

— User-specified data

`[]`

(default) | any MATLAB^{®} data type

User-specified data that you want to associate with the system, specified as any MATLAB data type.

`Name`

— System name

`''`

(default) | character vector

System name, specified as a character vector. For example, `'system_1'`

.

`SamplingGrid`

— Sampling grid for model arrays

structure array

Sampling grid for model arrays, specified as a structure array.

Use `SamplingGrid`

to track the variable values associated with each model in a model array, including identified linear time-invariant (IDLTI) model arrays.

Set the field names of the structure to the names of the sampling variables. Set the field values to the sampled variable values associated with each model in the array. All sampling variables must be numeric scalars, and all arrays of sampled values must match the dimensions of the model array.

For example, you can create an 11-by-1 array of linear models, `sysarr`

, by taking snapshots of a linear time-varying system at times `t = 0:10`

. The following code stores the time samples with the linear models.

` sysarr.SamplingGrid = struct('time',0:10)`

Similarly, you can create a 6-by-9 model array, `M`

, by independently sampling two variables, `zeta`

and `w`

. The following code maps the `(zeta,w)`

values to `M`

.

[zeta,w] = ndgrid(<6 values of zeta>,<9 values of w>) M.SamplingGrid = struct('zeta',zeta,'w',w)

When you display `M`

, each entry in the array includes the corresponding `zeta`

and `w`

values.

M

M(:,:,1,1) [zeta=0.3, w=5] = 25 -------------- s^2 + 3 s + 25 M(:,:,2,1) [zeta=0.35, w=5] = 25 ---------------- s^2 + 3.5 s + 25 ...

For model arrays generated by linearizing a Simulink^{®} model at multiple parameter values or operating points, the software populates `SamplingGrid`

automatically with the variable values that correspond to each entry in the array. For instance, the Simulink
Control Design™ commands `linearize`

(Simulink Control Design) and `slLinearizer`

(Simulink Control Design) populate `SamplingGrid`

automatically.

By default, `SamplingGrid`

is a structure with no fields.

## Object Functions

The following lists contain a representative subset of the functions you can use with
`pidstd`

models. In general, any function applicable to Dynamic System Models is
applicable to a `pidstd`

object.

### Linear Analysis

`step` | Step response plot of dynamic system; step response data |

`impulse` | Impulse response plot of dynamic system; impulse response data |

`lsim` | Plot simulated time response of dynamic system to arbitrary inputs; simulated response data |

`bode` | Bode plot of frequency response, or magnitude and phase data |

`nyquist` | Nyquist plot of frequency response |

`nichols` | Nichols chart of frequency response |

`bandwidth` | Frequency response bandwidth |

### Stability Analysis

### Model Transformation

### Model Interconnection

### Controller Design

`pidtune` | PID tuning algorithm for linear plant model |

`rlocus` | Root locus plot of dynamic system |

`pidstddata` | Access coefficients of standard-form PID controller |

`make2DOF` | Convert 1-DOF PID controller to 2-DOF controller |

`pidTuner` | Open PID Tuner for PID tuning |

`tunablePID` | Tunable PID controller |

## Examples

### Create Continuous-Time Standard-Form PDF Controller

Create a continuous-time standard-form PDF controller with proportional and derivative terms, and a filter divisor. To do so, set the integral time to infinite. Set the other gains and the filter divisor constant to the desired values.

Kp = 1; Ti = Inf; Td = 3; N = 6; C = pidstd(Kp,Ti,Td,N)

C = s Kp * (1 + Td * ------------) (Td/N)*s+1 with Kp = 1, Td = 3, N = 6 Continuous-time PDF controller in standard form

The display shows the controller type, formula, and parameter values, and verifies that the controller has no integrator term.

### Discrete-Time Standard-Form PI Controller

Create a discrete-time standard-form PI controller with trapezoidal discretization formula.

To create a discrete-time PI controller, set the value of `Ts`

and the discretization formula using `Name,Value`

syntax.

C2 = pidstd(1,0.5,'Ts',0.1,'IFormula','Trapezoidal') % Ts = 0.1s

C2 = 1 Ts*(z+1) Kp * (1 + ---- * --------) Ti 2*(z-1) with Kp = 1, Ti = 0.5, Ts = 0.1 Sample time: 0.1 seconds Discrete-time PI controller in standard form

Alternatively, you can create the same discrete-time controller by supplying `Ts`

as the fifth input argument after all four PID parameters, `Kp`

, `Ti`

, `Td`

, and `N`

. Since you only want a PI controller, set `Td`

to zero and `N`

to infinite.

C2 = pidstd(5,2.4,0,Inf,0.1,'IFormula','Trapezoidal')

C2 = 1 Ts*(z+1) Kp * (1 + ---- * --------) Ti 2*(z-1) with Kp = 5, Ti = 2.4, Ts = 0.1 Sample time: 0.1 seconds Discrete-time PI controller in standard form

The display shows that `C1`

and `C2`

are the same.

### Standard-Form PID Controller with Named Input and Output

When you create a PID controller, set the dynamic system properties `InputName`

and `OutputName`

. This is useful, for example, when you interconnect the PID controller with other dynamic system models using the `connect`

command.

C = pidstd(1,2,3,'InputName','e','OutputName','u')

C = 1 1 Kp * (1 + ---- * --- + Td * s) Ti s with Kp = 1, Ti = 2, Td = 3 Continuous-time PID controller in standard form

The display does not show the input and output names for the PID controller, but you can examine the property values. For instance, verify the input name of the controller.

C.InputName

`ans = `*1x1 cell array*
{'e'}

### Array of Standard-Form PID Controllers

Create a 2-by-3 grid of PI controllers with proportional gain ranging from 1–2 across the array rows and integral gain ranging from 5–9 across columns.

To build the array of PID controllers, start with arrays representing the gains.

Kp = [1 1 1;2 2 2]; Ti = [5:2:9;5:2:9];

When you pass these arrays to the `pidstd`

command, the command returns an array of controllers.

pi_array = pidstd(Kp,Ti,'Ts',0.1,'IFormula','BackwardEuler'); size(pi_array)

2x3 array of PID controller. Each PID has 1 output and 1 input.

Alternatively, use the `stack`

command to build an array of PID controllers.

Create a PID controller.

C = pidstd(1,5,0.1)

C = 1 1 Kp * (1 + ---- * --- + Td * s) Ti s with Kp = 1, Ti = 5, Td = 0.1 Continuous-time PID controller in standard form

Create a PIDF controller.

Cf = pidstd(1,5,0.1,0.5)

Cf = 1 1 s Kp * (1 + ---- * --- + Td * ------------) Ti s (Td/N)*s+1 with Kp = 1, Ti = 5, Td = 0.1, N = 0.5 Continuous-time PIDF controller in standard form

Stack the controllers along the second array dimension.

pid_array = stack(2,C,Cf);

This command returns a 1-by-2 array of controllers.

size(pid_array)

1x2 array of PID controller. Each PID has 1 output and 1 input.

All PID controllers in an array must have the same sample time, discrete integrator formulas, and dynamic system properties such as `InputName`

and `OutputName`

.

### Convert PID Controller from Parallel to Standard Form

Convert a parallel-form `pid`

controller to standard form.

Parallel PID form expresses the controller actions in terms of an overall proportional, integral, and derivative gains `Kp`

, `Ki`

and `Kd`

, and a filter time constant `Tf`

. You can convert any parallel-form controller to standard form using the `pidstd`

command, provided that:

The parallel-form controller is not a pure integrator.

The gains

`Kp`

,`Ki`

and`Kd`

all have the same sign.

For example, consider the following parallel-form controller.

Kp = 2; Ki = 3; Kd = 4; Tf = 5; C_par = pid(Kp,Ki,Kd,Tf)

C_par = 1 s Kp + Ki * --- + Kd * -------- s Tf*s+1 with Kp = 2, Ki = 3, Kd = 4, Tf = 5 Continuous-time PIDF controller in parallel form.

Convert this controller to standard form using `pidstd`

.

C_std = pidstd(C_par)

C_std = 1 1 s Kp * (1 + ---- * --- + Td * ------------) Ti s (Td/N)*s+1 with Kp = 2, Ti = 0.667, Td = 2, N = 0.4 Continuous-time PIDF controller in standard form

### Convert Dynamic System to Standard-Form PID Controller

Convert a continuous-time dynamic system that represents a PID controller to standard `pidstd`

form.

The following dynamic system, with an integrator and two zeros, is equivalent to a PID controller.

$$\mathit{H}\left(\mathit{s}\right)=\frac{3\left(\mathit{s}+1\right)\left(\mathit{s}+2\right)}{\mathit{s}}$$

Create a `zpk`

model of *H*. Then use the `pidstd`

command to obtain *H* in terms of the PID gains `Kp`

, `Ti`

, and `Td`

.

H = zpk([-1,-2],0,3); C = pidstd(H)

C = 1 1 Kp * (1 + ---- * --- + Td * s) Ti s with Kp = 9, Ti = 1.5, Td = 0.333 Continuous-time PID controller in standard form

### Convert Discrete-Time Dynamic System to Standard-Form PID Controller

Convert a discrete-time dynamic system that represents a PID controller with derivative filter to standard `pidstd`

form.

Create a discrete-time `zpk`

model that represents a PIDF controller (two zeros and two poles, including the integrator pole at `z`

= 1).

`sys = zpk([-0.5,-0.6],[1 -0.2],3,'Ts',0.1);`

When you convert `sys`

to PID form, the result depends on which discrete integrator formulas you specify for the conversion. For instance, use the default, `ForwardEuler`

, for both the integrator and the derivative.

C = pidstd(sys)

C = 1 Ts 1 Kp * (1 + ---- * ------ + Td * ---------------) Ti z-1 (Td/N)+Ts/(z-1) with Kp = 2.75, Ti = 0.0458, Td = 0.00758, N = 0.0909, Ts = 0.1 Sample time: 0.1 seconds Discrete-time PIDF controller in standard form

For this particular dynamic system, you cannot write `sys`

in standard PID form using the `BackwardEuler`

formula for the derivative filter. Doing so would result in `N`

< 0, which is not permitted. In that case, `pidstd`

returns an error.

Similarly, you cannot write `sys`

in standard PID form using the `Trapezoidal`

formula. Doing so would result in negative `Ti`

and `Td`

, which is also not permitted.

### Discretize Continuous-Time Standard-Form PID Controller

Discretize a continuous-time PID controller and set integral and derivative filter formulas.

Create a continuous-time PIDF controller and discretize it using the zero-order-hold method of the `c2d`

command.

```
Ccon = pidstd(1,2,3,4);
Cdis1 = c2d(Ccon,0.1,'zoh')
```

Cdis1 = 1 Ts 1 Kp * (1 + ---- * ------ + Td * ---------------) Ti z-1 (Td/N)+Ts/(z-1) with Kp = 1, Ti = 2, Td = 3.2, N = 4, Ts = 0.1 Sample time: 0.1 seconds Discrete-time PIDF controller in standard form

The display shows that `c2d`

computes new PID gains for the discrete-time controller.

The discrete integrator formulas of the discretized controller depend on the `c2d`

discretization method. For the `zoh`

method, both `IFormula`

and `DFormula`

are `ForwardEuler`

.

Cdis1.IFormula

ans = 'ForwardEuler'

Cdis1.DFormula

ans = 'ForwardEuler'

If you want to use different formulas from the ones returned by `c2d`

, then you can directly set the `Ts`

, `IFormula`

, and `DFormula`

properties of the controller to the desired values.

Cdis2 = Ccon; Cdis2.Ts = 0.1; Cdis2.IFormula = 'BackwardEuler'; Cdis2.DFormula = 'BackwardEuler';

However, these commands do not compute new PID gains for the discretized controller. To see this, examine `Cdis2`

and compare the coefficients to `Ccon`

and `Cdis1`

.

Cdis2

Cdis2 = 1 Ts*z 1 Kp * (1 + ---- * ------ + Td * -----------------) Ti z-1 (Td/N)+Ts*z/(z-1) with Kp = 1, Ti = 2, Td = 3, N = 4, Ts = 0.1 Sample time: 0.1 seconds Discrete-time PIDF controller in standard form

## Version History

**Introduced in R2010b**

## MATLAB 命令

您点击的链接对应于以下 MATLAB 命令：

请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。

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