Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: A differential inside another differential - DAES
Replies: 1   Last Post: Mar 8, 2013 2:35 AM

 Torsten Posts: 1,717 Registered: 11/8/10
Re: A differential inside another differential - DAES
Posted: Mar 8, 2013 2:35 AM

"Elsis" wrote in message <khaghp\$q69\$1@newscl01ah.mathworks.com>...
> Hello
>
> I have a set of DAES, but I have one differential inside another something like this:
>
> Dx(1)=x(2)-x(1)
> 0=x(2)-K*x(1) >>> an algebraic equation
> Dx(3)=K*Dx(1)+K*x(3)
>
> is it possible to solve a system like this on Matlab or I should require to do something extra to solve it?
>
> thanks! have a nice day!
>
> Elsa

Three ways to rewrite your DAE system:

Either you define the mass matrix for the system above as
M=[1 0 0; 0 0 0; -K 0 1]
and the right-hand side vector as
f=[x(2)-x(1);x(2)-K*x(1);K*x(3)]

or, since Dx1 = x(2)-x(1), you can insert this expression directly into the third
equation to get
Dx(1)=x(2)-x(1)
0=x(2)-K*x(1) >>> an algebraic equation
Dx(3)=K*(x(2)-x(1))+K*x(3)=K*(x(2)-x(1)+x(3))
and thus
M=[1 0 0; 0 0 0; 0 0 1]
f=[x(2)-x(1);x(2)-K*x(1);K*(x(2)-x(1)+x(3))]
or you solve for x(2) from the algebraic equation and insert in the other two:
from the algebraic equation you get x(2)=K*x(1) and thus
Dx(1) = x(2)-x(1) = K*x(1)-x(1)=(K-1)*x(1)
Dx(3) = K*Dx(1)+K*x(3)=K*(K-1)*x(1)+K*x(3)=K*((K-1)*x(1)+x(3))

Best wishes
Torsten.