Q:

Solving DAE with higher index

I want to solve 7 coupled differential equations in MATLAB. I used the method of lines (MOL) to convert them to a system of DAEs. I then attempted to solve this system using ode15s. Unfortunately an error occurred that said: the index of equation is greater than 1. I searched and know I should reduce the index of equation. But I dont know how can I do this in MATLAB?
I have simplified equations and assume T=CONSTANT so these  are 3 equations: 
$1:'(∂C_(g))/∂t+ u_g  (∂C_(g))/∂z= -k_g A_o (C_(g)-C_(p) |_(r=r_OD ) )+A_o ε_f u_cp |_(r_OD ) C_(p) |_(r_OD )'$
$2:(∂C_(p))/∂t+(u_cp C_(p))/r+u_cp  (∂C_(p))/∂r-D_eff ((∂^2 C_(p))/(∂r^2 )+1/r  (∂C_(p))/∂r)=-((1-ε_f))/ε_f  ρ_f  (∂q_)/∂t$
$3:(∂q)/∂t=ks (q^eq-q)$
$4:q^eq=(qs.b.P_)/〖(1+(b.P_ )^n)〗^(1/n)$
$5:P=C(p)RT$   
and these are initial and boundry conditions:
at $t=0$  $q=0$, $cp=0$ and $cg=0$
at $z=0$ $cg=constant$
ar $r=riD$  $(∂C_(i,p))/∂r=0$
at $r=roD$   $Deff.(∂C_(i,p))/∂r=kg.(cg(z)-cp(r=roD)$  
I convert them to system of odes in time.
these are equations:
$i$ is used for lenght(z).and $j$ is used for radius(r)  
$1':dcg(i,j)=((-1).*(Ug).*(((cg(i,j))-(cg(i-1,j)))./((deltaz))))-((kg)*(Ao).*((cg(i,nr2))-(cp(i,nr2))))+((Ao)*(epsilonf).*(Ucp)*(cp(i,nr2)))$
$2':dcp(i,j)=(((-1).*(Ucp).*(cp(i,j)))./((Ri)+((j-1)*(deltar))))-((Ucp).*(((cp(i,j))-(cp(i,j-1)))./((deltar))))+((Deff).*((((cp(i,j+1)))-(2*cp(i,j))+(cp(i,j-1)))./(deltar^2))+(((1)/((Ri)+((j-1)*(deltar)))).*(((cp(i,j))-(cp(i,j-1)))./((deltar)))))-((((1)-(epsilonf))/(epsilonf))*(ROf).*(dq(i,j)))$
$3': dq(i,j)=ks*(qeq(i,j)-q(i,j))$  

A:

There are many definitions of DAE index. MATLAB is probably referring to the differentiation index. A few integrators can solve Hessenberg form index-2 DAEs (I believe IDA can do this, along with a few other packages), but most require the index to be 1 or less. Reducing the index of your DAE requires manipulating the underlying equations in the DAE, e.g., using Pantelides' algorithm or the dummy derivative method. Usually, this sort of thing is done in software that has some sort of algebraic manipulation capabilities, like Mathematica, Maple, Sage, or SymPy, so in your case, you would use one of the above approaches to derive an equivalent reduced-index DAE, and then transcribe it into MATLAB and solve it with ode15s.

