# pidstddata

Access coefficients of standard-form PID controller

## Syntax

```[Kp,Ti,Td,N] = pidstddata(sys)[Kp,Ti,Td,N,Ts] = pidstddata(sys)[Kp,Ti,Td,N,Ts] = pidstddata(sys, J1,...,JN)```

## Description

```[Kp,Ti,Td,N] = pidstddata(sys)``` returns the proportional gain `Kp`, integral time `Ti`, derivative time `Td`, and filter divisor `N` of the standard-form controller represented by the dynamic system `sys`.

```[Kp,Ti,Td,N,Ts] = pidstddata(sys)``` also returns the sample time `Ts`.

```[Kp,Ti,Td,N,Ts] = pidstddata(sys, J1,...,JN)``` extracts the data for a subset of entries in the array of `sys` dynamic systems. The indices `J` specify the array entries to extract.

## Input Arguments

 `sys` SISO dynamic system or array of SISO dynamic systems. If `sys` is not a `pidstd` object, it must represent a valid PID controller that can be written in standard PID form. `J` Integer indices of N entries in the array `sys` of dynamic systems.

## Output Arguments

 `Kp` Proportional gain of the standard-form PID controller represented by dynamic system `sys`. If `sys` is a `pidstd` controller object, the output `Kp` is equal to the `Kp` value of `sys`. If `sys` is not a `pidstd` object, `Kp` is the proportional gain of a standard-form PID controller equivalent to `sys`. If `sys` is an array of dynamic systems, `Kp` is an array of the same dimensions as `sys`. `Ti` Integral time constant of the standard-form PID controller represented by dynamic system `sys`. If `sys` is a `pidstd` controller object, the output `Ti` is equal to the `Ti` value of `sys`. If `sys` is not a `pidstd` object, `Ti` is the integral time constant of a standard-form PID controller equivalent to `sys`. If `sys` is an array of dynamic systems, `Ti` is an array of the same dimensions as `sys`. `Td` Derivative time constant of the standard-form PID controller represented by dynamic system `sys`. If `sys` is a `pidstd` controller object, the output `Td` is equal to the `Td` value of `sys`. If `sys` is not a `pidstd` object, `Td` is the derivative time constant of a standard-form PID controller equivalent to `sys`. If `sys` is an array of dynamic systems, `Td` is an array of the same dimensions as `sys`. `N` Filter divisor of the standard-form PID controller represented by dynamic system `sys`. If `sys` is a `pidstd` controller object, the output `N` is equal to the `N` value of `sys`. If `sys` is not a `pidstd` object, `N` is the filter time constant of a standard-form PID controller equivalent to `sys`. If `sys` is an array of dynamic systems, `N` is an array of the same dimensions as `sys`. `Ts` Sample time of the dynamic system `sys`. `Ts` is always a scalar value.

## Examples

Extract the proportional, integral, and derivative gains and the filter time constant from a standard-form `pidstd` controller.

For the following `pidstd` object:

`sys = pidstd(1,4,0.3,10);`

you can extract the parameter values from `sys` by entering:

`[Kp Ti Td N] = pidstddata(sys);`

Extract the standard-form proportional and integral gains from an equivalent parallel-form PI controller.

For a standard-form PI controller, such as:

`sys = pid(2,3);`

you can extract the gains of an equivalent parallel-form PI controller by entering:

`[Kp Ti] = pidstddata(sys)`

These commands return the result:

```Kp = 2 Ti = 0.6667```

Extract parameters from a dynamic system that represents a PID controller.

The dynamic system

$H\left(z\right)=\frac{\left(z-0.5\right)\left(z-0.6\right)}{\left(z-1\right)\left(z+0.8\right)}$

represents a discrete-time PID controller with a derivative filter. Use `pidstddata` to extract the standard-form PID parameters.

```H = zpk([0.5 0.6],[1,-0.8],1,0.1); % sample time Ts = 0.1s [Kp Ti Td N Ts] = pidstddata(H);```

the `pidstddata` function uses the default `ForwardEuler` discrete integrator formula for `Iformula` and `Dformula` to compute the parameter values.

Extract the gains from an array of PI controllers.

```sys = pidstd(rand(2,3),rand(2,3)); % 2-by-3 array of PI controllers [Kp Ti Td N] = pidstddata(sys);```

The parameters `Kp`, `Ti`, `Td`, and `N` are also 2-by-3 arrays.

Use the index input `J` to extract the parameters of a subset of `sys`.

`[Kp Ti Td N] = pidstddata(sys,5);`

expand all

### Tips

If `sys` is not a `pidstd` controller object, `pidstddata` returns `Kp`, `Ti`, `Td` and `N` values of a standard-form controller equivalent to `sys`.

For discrete-time `sys`, `piddata` returns parameters of an equivalent `pidstd` controller. This controller has discrete integrator formulas `Iformula` and `Dformula` set to `ForwardEuler`. See the `pidstd` reference page for more information about discrete integrator formulas.