# c2d

Computes a discrete-time state-space model from a continuous-time state-space model.

## Syntax

SYSD = c2d(SYSC, Ts)

SYSD = c2d(SYSC, Ts, METHOD)

SYSD = c2d(SYSC, Ts, 'prewarp', W0)

## Inputs

`SYSC`- Continuous-time state-space model.
`Ts`- Sampling time in seconds.
`METHOD`- A string to specify the method used to convert the
`SYSC`model to the SYSD model.- zoh
- Zero-Order-Hold method (default method).
- prewarp
- Pre-warp method. This method requires
`W0`. - tustin
- Tustin approximation method.
- bilin
- Bilinear transformation.

`W0`- The pre-warp frequency.

## Outputs

- SYSD
- A discrete-time state-space model.

## Example

Default method:

```
A = [10.0 5;
5 10 ];
B = [0.0 -10;
10 0.0 ];
C = [-10 0.0;
0.0 10 ];
D = [10 0.0;
0.0 -10 ];
ResSys1 = c2d (ss (A, B, C, D), 2, 'zoh')
```

`
ResSys1 = object [
Scaled: 0
TimeUnit: seconds
ts: 2
a: [Matrix] 2 x 2
5.34324e+12 5.34324e+12
5.34324e+12 5.34324e+12
b: [Matrix] 2 x 2
3.56216e+12 -3.56216e+12
3.56216e+12 -3.56216e+12
c: [Matrix] 2 x 2
-10 0
0 10
d: [Matrix] 2 x 2
10 0
0 -10
e: [Matrix] 0 x 0
type: StateSpaceModel
]`

Using the pre-warp method:

`ResSys2 = c2d (ss (A, B, C, D), 2, 'prewarp',0.5) %For the same state space matrices given above`

`ResSys2 = object [
Scaled: 0
TimeUnit: seconds
ts: 2
a: [Matrix] 2 x 2
-1.28904 0.15908
0.15908 -1.28904
b: [Matrix] 2 x 2
1.17581 2.13639
-2.13639 -1.17581
c: [Matrix] 2 x 2
2.13639 -1.17581
1.17581 -2.13639
d: [Matrix] 2 x 2
1.30930 -15.79057
-15.79057 -18.69070
e: [Matrix] 0 x 0
type: StateSpaceModel
]`

## Comments

Computes a discrete-time state-space model from a continuous-time state-space model.

SYSD = c2d(SYS, Ts, METHOD) computes the discrete-time
approximation of the continuous-time systems models `SYS`, with sampling
period `T`'s using `METHOD`.

Based on the SLICOT library functions ab04md and expm.