I am having hard time to convert following set of differential equation to state space equation. I am a biologist and my math skills fall short as I don't know where to start. Any suggestion or feedback is highly appreciated. Thanks in advance.


**Updates**:
Based on comments I have updated the question (which is not a good practice, my sincere apologies to everyone),  

I am modelling biological system with a cascade of signal transduction steps with feedback loops. Each level in the cascade has corresponding equation $\dot{y\_i}$ or $dy\_i/dt$ given by
\begin{equation\*}
\frac{dy\_i}{dt}= g\_i(v\_i, y\_i)+ c\_i + e\_i
\end{equation\*}
For example
\begin{equation\*}
\frac{dy\_0}{dt}= g\_0(a\_{00}y\_0+a\_{02}y\_2, y\_0)+ c\_0
\end{equation\*}
\begin{equation\*}
\frac{dy\_1}{dt}= g\_1(a\_{10}y\_0+a\_{11}y\_1+a\_{12}y\_2, y\_1)\\
\end{equation\*}
\begin{equation\*}
\frac{dy\_2}{dt}= g\_2(a\_{20}y\_0+a\_{21}y\_1+a\_{22}y\_2+a\_{23}y\_3+a\_{24}y\_4+a\_{25}y\_5, y\_2)+e\_2
\end{equation\*}
\begin{equation\*}
\frac{dy\_3}{dt}= g\_3(a\_{32}y\_2+a\_{33}y\_3, y\_3)
\end{equation\*}
\begin{equation\*}
\frac{dy\_4}{dt}= g\_4(a\_{42}y\_2+a\_{44}y\_4, y\_4)
\end{equation\*}
\begin{equation\*}
\frac{dy\_5}{dt}= g\_5(a\_{25}x\_2-a\_{25}x\_5)
\end{equation\*}


and so on. $y\_i$ represents state variable and only $y\_5$ can be observed ("output") others are hidden. $e\_2$ is input variable. $a\_{jk}$ represents parameters. Function $g\_i$ is given by multiplication of $h\_i$ and $r\_i$
\begin{equation\*}
g\_i({v\_i}, y\_i)= h\_i ({v\_i})\cdot r\_i({v\_i}, y\_i)\\
\end{equation\*}
where function $h\_i$ and $r\_i$ are given by  

\begin{equation\*}
h\_i({v\_i}) = \begin{cases} \frac{{v\_i}}{1+\frac{{v\_i}}{S\_i}(1-exp(-{v\_i}/S\_i))} & \mbox{when } {v\_i}> 0, \cr {v\_i} & \mbox{when } {v\_i}\leq 0, \end{cases}
\end{equation\*}
\begin{equation\*}
r\_i({v\_i}, y) = \begin{cases} 1-exp(\frac{{v\_i}^2S\_i}{{v\_i}(\varepsilon -y)^2}) & \mbox{when } y<\varepsilon\ \&\ {v\_i}< 0, \cr 1 & \mbox{otherwise.} \end{cases}
\end{equation\*}


where


Function $h\_i$ puts physiologically relevant soft upper limit.


Function $r\_i$ ensures non-negative ligand concentration.


$\dot v$ is corresponding linear rate.


$S\_i$ is max size of the pool.


$\varepsilon$ is a small positive constant.


**Update-2:**
Ok, I want to know if I am doing right thing here.
I need state space equation for my system of differential equation with nonlinear function. Technically I can have two different versions


**A non-linear version**
\begin{equation\*}
\frac{dy\_i}{dt}= g\_i(v\_i, y\_i)+ c\_i + e\_i
\end{equation\*}


**A linear version**
\begin{equation\*}
\frac{dy\_i}{dt}= v\_i+ c\_i + e\_i
\end{equation\*}


For linear version I can write the state equation as
$y'= Ay+c+e$ ([see the matrix equation as Image](http://farm5.static.flickr.com/4150/4973551912_6b8a7c4d49.jpg))


Taking this to next step can I write like following?


$y'= g(Ay)+c+e$



Converting an ODE system to State space formulation
Ok, let me give this a shot:


* Because your system is nonlinear, I'm assuming you want the nonlinear state-space form. You can easily get the linear form by doing a Taylor series expansion on it around some equilibrium point.
* The fact that most of the states are not measurable is not a big problem. You can estimate them using your output variables (subject to observability conditions), using an state observer such as a Kalman filter, Moving Horizon Estimator (MHE) or a Luenberger observer. Also note for a nonlinear system, only local observability can be checked.
* Because you have conditional statements, I don't believe you'll be able to write the above as a single state-space system. You have 4 conditions, but they can be reduced to 3 disjunctions, so you'll need 3 state-space systems and a conditional switching equation that "activates" the correct state-space system depending on the values of $v$ and $y$. This is known as a hybrid (or switched) system.
* As to the treatment of a hybrid system, perhaps you could clarify what the purpose is of getting your model into state-space form. Is it for simulation reasons? Do you need it in order to do analysis (i.e. controllability, observability)? Or do you need to do optimization? If it is the last case, you can write the logic as a disjunctive program, which will allow you generate a very efficient mixed-integer programming (MIP) problem.


Anyway, this is one way of writing your state-space system:


$$
\begin{align}
\frac{dy\_{i}}{dt} &= g\_{i}^{m}(v\_{i},y\_{i}) + p\_{i} c\_{i} + q\_{i} e\_{i},\quad i=0,\ldots,N-1\\
v\_{i} &= \sum\_{j=0}^{N-1} a\_{ij}y\_{j},\quad i=0,\ldots,N-1
\end{align}
$$
where $p\_{i},q\_{i} \in \{0,1\}$ = coefficients, $N$ = number of states, and $m \in \{1,2,3\}$ = modes of the system. In addition, you will need a switching function $T(m,v\_{i},y\_{i}) = 0$ to select the appropriate modes based on the current states of your system. This can be done programmatically through `IF-THEN-ELSE` clauses (or via integer variables in an optimization problem). 


* For $m = 1$ (where $v\_{i} < 0, y\_{i} < \varepsilon$):


$$g\_{i}^{1}(v\_{i},y\_{i}) = v\_{i} \left[1-\exp\left(\frac{{v\_i}^2S\_i}{{v\_i}(\varepsilon -y\_{i})^2}\right)\right]$$


* For $m = 2$ (where $v\_{i} \leq 0, y\_{i} \geq \varepsilon$):


$$g\_{i}^{2}(v\_{i},y\_{i}) = v\_{i}$$


* For $m = 3$ (where $v\_{i} > 0, y\_{i} \in \mathbb{R}$):


$$g\_{i}^{3}(v\_{i},y\_{i}) = \frac{{v\_i}}{1+\frac{{v\_i}}{S\_i}(1-\exp(-{v\_i}/S\_i))}$$


