help-octave
[Top][All Lists]

## DAE daspk solver problem

 From: Lazy_Tom Subject: DAE daspk solver problem Date: Wed, 26 Oct 2016 14:23:01 -0700 (PDT)

```Hi all,

I'd like to use the daspk solver for DAE that comes with Octave but I can't
find any official example on how to use it so I decided to give it a go
myself.
I've tried to solve the pendulum equations in cartesian coordinates but I'm
having a hard time working out why the solver it is not working.

the variables are as follows

x(1)=position x
x(2)=velocity x
x(3)=position y
x(4)=velocity y
x(5)=reaction force intensity

xdot(1)=velocity x
xdot(2)=acceleration x
xdot(4)=velocity y
xdot(5)=velocity y

and the script is

t=linspace(0,5,1000)';
m=1;
g=9.81;

function f=effe(x,xdot, t)

m=1;
g=9.81;

f(1) = xdot(1)-x(2);
f(2) = m*xdot(2)+x(5)*x(1);
f(3) = xdot(3)-x(4);
f(4) = m*xdot(4) + x(5)*x(3) +m*g;
f(5) = x(1)^2 + x(3)^2 - 1;
endfunction
daspk_options('print initial condition info', 1);
daspk_options('compute consistent initial condition', 1);
daspk_options('algebraic variables', [0,0,0,0,1]);

[x, XDOT, ISTATE, MSG] = daspk (@effe, [1,0, 0, 0, m*g], [0,0,0,g,0], t);

any help would be appreciated.

Regards

Marco

--
View this message in context:
http://octave.1599824.n4.nabble.com/DAE-daspk-solver-problem-tp4680377.html
Sent from the Octave - General mailing list archive at Nabble.com.

```