# What is the index of a given DAE system of equations?

I have very simple multi-body dynamic system from which I have to solve following DAE:

$\textbf{q}(t) - 3 \times1 \text{ vector of known state variables}$

$\phi(\textbf{q}(t))=0 - 2 \times 1 - \text{ vector function of multibody constraints }$

$A(t,\textbf{q}(t)), M - 3 \times 3 \text{ known matrices}$

$\textbf{p}(t), \textbf{w}(t)- 3 \times 1 \text{ unknown vector functions}$

$\textbf{m}(t)-2 \times 1 \text{ unknown vector function}$

$$\dot{\textbf{p}}=A \cdot \textbf{w} + \phi_q^T \cdot \textbf{m}$$ $$M \cdot \dot{\textbf{w}} = \textbf{p}$$ $$0 = \phi_q \cdot \textbf{w}$$ $$\textbf{p}(0)=[1,0,0]^T$$ $$\textbf{w}(0)=[0,0,0]^T$$

The system contains algebraic equation for $\textbf{w}$ which by itself gives index equal to 1. However, equation ($1$) has one algebraic function ($\textbf{m}$) that confuses me.

1. Should it also be taken into account while evaluating index? If so, could you show how to calculate it?
2. Moreover, if the index is higher than 1, I will have to transformate this system into one equal to it. If this is simple task, can I ask you to show how to perform it? If not, could you navigate me to useful sites or books?
3. I need to solve this system in Matlab, preferably using ode15s. Any help regarding how to map this DAE into Matlab environment would be appreciated.

Having investigated Scholarpedia, I am able to respond to first question. We can distinguish certian class of DAEs called semi-explicit, such as: \begin{array}{ccc} y' & = & f(t,y,z) \\ 0 & = & g(t,y,z), \end{array} where $x=[y,z]$ is the solution, $y$ are differential variables, $z$ are algebraic variables and $t$ is independent variable. System shown above is generally index 1, however if we rewrite it in such way: \begin{array}{ccc} y' & = & f(t,y,z) \\ 0 & = & g(t,y), \end{array} we see that after derivation of the second equation we still have algebraic-only variables in equation (1) and one more derivation is needed to yield ODE. And this is exactly the case for equations (1) and (3) from question. Hence index = 2, question one is solved.
As far as question 2 is concerned, one way to reduce index is to derivate equation (3) with respect to time to get: $$0 = (\phi_q \cdot \textbf{w})_q \cdot \textbf{v}+\phi_q \cdot \dot{\textbf{w}}$$ where $\textbf{v}=\frac{d \textbf{q}}{dt}$. However quoting Matlab site one have to keep in mind to: