help-octave
[Top][All Lists]

## dassl and daspk

 From: pg123 Subject: dassl and daspk Date: Sat, 1 Jan 2011 05:40:23 -0800 (PST)

```I have a problem : I try to solve the problem of sliding pendulum (this is
the Scilab example).
This works well with dassl but not with daspk. Here is the code :

function res = f (yy, ydot, t)
global omega g M m l k;
%%res=zeros(7,1);
x=yy(1);
y=yy(2);
theta=yy(3);
u=yy(4:6);
lamda=yy(7);
xprim=ydot(1);
yprim=ydot(2);
thetaprim=ydot(3);
uprim=ydot(4:6);
res=[xprim-u(1);
yprim-u(2);
thetaprim-u(3);

(M+m)*uprim(1)+m*l*cos(theta)*uprim(3)-m*l*sin(theta).*(u(3).^2)+lamda*(-2*x+omega*sin(omega.*x)./3.0)+k.*u(1);
(M+m)*uprim(2)+m*l*sin(theta)*uprim(3)+m*l*cos(theta)*(u(3).^2)+
(M+m)*g+lamda+k*u(2);
m*l*cos(theta)*uprim(1)+m*l*sin(theta)*uprim(2)+m*(l.^2)*uprim(3)+
m*g*sin(theta);
-((-2*x+omega*sin(omega*x)/3)*u(1)+u(2))];
endfunction

%% The program

global omega g M m l k
omega=3.3;
g=9.81;
l=1;
m=1;
M=1;
k=0.5;
y_0=[1,1+cos(omega)/3,0,0,0,0,0];
ydot_0=[0,0,0,0,-g,0,0];
t0=0.0;
t=(0:0.1:20);

%% Works with dassl
dassl_options("relative tolerance",1e-2);
dassl_options("absolute tolerance",1e-2);
[X, XDOT, ISTATE, MSG]= dassl(@f, y_0, ydot_0, t);

%% But does not work with daspk :
%% daspk_options("absolute tolerance",1e-2);
%% daspk_options("relative tolerance",1e-2);
%% [X1, XDOT1, ISTATE1, MSG1]= daspk (@f, y_0, ydot_0, t);
%% MSG1
%% %%MSG1 = repeated error test failures on the last attempted step (t = 0)

Can someone explain me where is the problem ?
Thank you.

Pascal Grandeau

--
View this message in context:
http://octave.1599824.n4.nabble.com/dassl-and-daspk-tp3170121p3170121.html
Sent from the Octave - General mailing list archive at Nabble.com.

```