[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help need for Differential algebraic equations
From: |
John W. Eaton |
Subject: |
Re: Help need for Differential algebraic equations |
Date: |
Thu, 09 Oct 2008 13:47:55 -0400 |
On 9-Oct-2008, genehacker wrote:
|
| Thanks for the reply Olaf. I defnitely changed the function return variable,
| that should be different from xdot. But i still have a problem of running a
| simple differential algebraic equation. I am getting the same answer, if i
| tried a much simpler set of equations(even though I didnot use an algebraic
| equation here, I intend to use it later on). [ Also, you asked why I am
| doing x(2) = f*x(6), thats is the type of algebraic equation i intend to
| use]. Is there something inherently wrong with my code? I couldnot get much
| help about this online.
|
| **********code ********
| function res = f(x,xdot,t);
| res = zeros(3,1);
| k12=0.1;
| k23=0.7;
|
| xdot(1) = -k12*x(1);
| xdot(2) = k12*x(1) - k23*x(2);
| xdot(3) = k23*x(2);
|
| endfunction;
X nad XDOT are parameters to your function. Changing them has no
effect. If you are solving a DAE with dassl, you should be defining a
residual funtion F such that it computes RES as a function of X, XDOT,
and T. Your function above simply sets RES to zero.
If your function is as you show above, then it looks like an ODE, not
a DAE.
jwe