# Documentation

## State-Space Model with Both Fixed and Tunable Parameters

This example shows how to create a state-space (`genss`) model having both fixed and tunable parameters.

Create a state-space model having the following state-space matrices:

$A=\left[\begin{array}{cc}1& a+b\\ 0& ab\end{array}\right],\text{ }B=\left[\begin{array}{c}-3.0\\ 1.5\end{array}\right],\text{ }C=\left[\begin{array}{cc}0.3& 0\end{array}\right],\text{ }D=0,$

where a and b are tunable parameters, whose initial values are –1 and 3, respectively.

1. Create the tunable parameters using `realp`.

``` a = realp('a',-1); b = realp('b',3);```
2. Define a generalized matrix using algebraic expressions of `a` and `b`.

`A = [1 a+b;0 a*b]`

`A` is a generalized matrix whose `Blocks` property contains `a` and `b`. The initial value of `A` is `M = [1 2;0 -3]`, from the initial values of `a` and `b`.

3. Create the fixed-value state-space matrices.

```B = [-3.0;1.5]; C = [0.3 0]; D = 0;```
4. Use `ss` to create the state-space model.

`sys = ss(A,B,C,D)`

`sys` is a generalized LTI model (`genss`) with tunable parameters `a` and `b`.