I thank you for your interesting question of the 20th, because I need to learn
to solve differential-algebraic equations. I'm not particularly familiar with
daspk yet, so I don't know why your third example isn't working, but you can
solve the third and fourth equations (the algebraic ones) for x(3) and x(4) by
hand, and just substitute those values back into the first two equations,
turning the system into a pure differential equation (please check my work to
see if I got the equations correct):
function f = exam4f(x, xdot, t)
f(1) = xdot(1)+t*x(2)+(1.0+t)*(x(2)-5*sin(t^2/2));
f(2) = xdot(2)+t*x(1)+(1.0+t)*5*(x(1)-5*cos(t^2/2));
Still using daspk (because it was handy), I tried this function and got a solution.
The solution gets really truly enormous very quickly, so I don't know whether
to believe it or not, but at least it doesn't crash.
Allen Windhorn P.E. (Mn), CEng| Senior Principal Engineer
Leroy-Somer Americas | Kato Engineering, Inc.
2075 Howard Dr. West | North Mankato, MN 56003 | USA
T +1 507-345-2782 | F +1 507-345-2798
[hidden email] | [hidden email]
i've figured this out. there were two issues
1) analytical jacobian needs to be supplied to solve succesfully.
2) two sign typos in the paper need to be corrected (in second and fourth
equation of the third example).
so the final working code exactly matching the numerical examples from
section V of the paper looks like
> -----Original Message-----
> From: Help-octave <help-octave-bounces+allen.windhorn=[hidden email]> On Behalf Of vmz
> i've figured this out. there were two issues
> 1) analytical jacobian needs to be supplied to solve succesfully.
> 2) two sign typos in the paper need to be corrected (in second and fourth
> equation of the third example).
> so the final working code exactly matching the numerical examples from
> section V of the paper looks like ...
I'm glad you got it working -- thanks for posting the result, as I have an
interest in this.