singular jacobian error by solvin 2.Order ODE with bvp4c and Parameters

hi there, i'm working for a while on this problem and hope someone could help me.
I want to to solve a BVP for a invertet double pendulum to get the parameters (p)for a swing-up trajectory.
unfortunately i get the error....
??? Error using ==> bvp4c at 252 Unable to solve the collocation equations -- a singular Jacobian encountered.
Error in ==> Trajectory at 11 sol=bvp4c(@ODE,@BC,solinit);
oooooooooooooooooooooooooooooooooooooooooooooo
clear all
close all
global T g
T=2.2;
g=9.81;
solinit = bvpinit(linspace(0,T,10),[1 1 0 0], [0 0 0 0]);
sol=bvp4c(@ODE,@BC,solinit);
----------------------------------------------------------
function dydx = ODE( x,y,p )
global g T
l1=0.323;
l2=0.480;
a1=0.215;
a2=0.223;
m1=0.853;
m2=0.510;
J1=0.013;
J2=0.019;
d1=0.005;
d2=0.005;
n1=y(1);
np1=y(2);
n2=y(3);
np2=y(4);
G=[J1+a1^2*m1+l1^2 a2*l1*m2*cos(n1-n2)
a2*l1*m2*cos(n1-n2) J2+a2^2*m2 ];
a0=-p(1)-p(3);
a1=-p(2)-p(4);
Ypp= -(pi/T)^2*(a1*cos((1*pi*x)/T) ...
+4*p(1)*cos((2*pi*x)/T) ...
+9*p(2)*cos((3*pi*x)/T) ...
+16*p(3)*cos((4*pi*x)/T) ...
+25*p(4)*cos((5*pi*x)/T));
b=[d1*np1+d2*(np1-np2)+l1*m2*a2*sin(n1-n2)*np2^2-(a1*m1+l1*m2)*(g*sin(n1)+cos(n2)*Ypp)
d2*(np2-np1)-a2*m2*(g*sin(n2)+l1*sin(n1-n2)*np1^2+cos(n2)*Ypp)];
n =G\b;
dydx=[y(2)
n(1)
y(4)
n(2)];
end
------------------------------------------------------------------
function res = BC( ya,yb,p )
res=[ya(1)+pi
ya(2)
ya(3)+pi
ya(4)
yb(1)
yb(2)
yb(3)
yb(4)];
end
oooooooooooooooooooooooooooooooooooooooooooooo
thanks a lot so far

Answers (0)

Asked:

on 20 May 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!