# Discrete Varying State Space

Discrete-time state-space model with varying matrix values

**Libraries:**

Control System Toolbox /
Linear Parameter Varying

## Description

Use this block to implement a discrete-time state-space model with varying matrices.
Feed the instantaneous values of the state matrix *A*, input matrix
*B*, output matrix *C*, and feedforward matrix
*D* to the corresponding input ports. The system response is given
by:

$$\begin{array}{c}{x}_{k+1}=A{x}_{k}+B{u}_{k}\\ {y}_{k}=C{x}_{k}+D{u}_{k},\end{array}$$

where *u _{k}* is the system input,

*y*is the system output,

_{k}*x*is the current system state, and

_{k}*x*

_{k+1}is the system state at the next time step.

Use this block and the other blocks in the Linear Parameter Varying library to implement common control elements with variable parameters or coefficients. For more information, see Model Gain-Scheduled Control Systems in Simulink.

**Caution**

Avoid making the **C** and **D** matrices depend
on the system output **y _{k}**. If you have
such dependence, the resulting state-space equation

*y*=

_{k}*C*(

*y*)

_{k}*x*+

_{k}*D*(

*y*)

_{k}*u*creates an algebraic loop, because computing the output value

_{k}*y*requires knowing the output value. This algebraic loop is prone to instability and divergence. Instead, try expressing

_{k}**C**and

**D**in terms of the time

*t*, the block input

**u**, and the state outputs

_{k}**x**.

_{k}For similar reasons, avoid making **A** and
**B** depend on the
**x _{k+1}** output. Note that it is safe
for

**A**and

**B**to depend on

**y**when

_{k}**y**is a fixed combination of states and inputs (in other words, when

_{k}*y*=

_{k}*C*

*x*+

_{k}*D*

*u*, where

_{k}*C*and

*D*are constant matrices).

## Ports

### Input

### Output

## Parameters

## Extended Capabilities

## Version History

**Introduced in R2017b**