Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Error using bvp4c (singular jacobian encountered)
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I'm trying to run the following code, but keep running into an error:
E,I, F, and all other parameters below are constant and defined before running this solver.
init=bvpinit(0:0.01:1,u1);
sol = bvp4c(@(sig,u)odefun(sig,u,s_obj,x_obj,y_obj,theta_obj,theta0,F,E,I,x(1),y(1)),...
@(uinitial,u1)bc(uinitial,u1,s_obj,x0,y0,theta_obj,theta0,F,E,I,x1,y1),...
init);
function du=odefun(sig,u,s_obj,x_obj,y_obj,theta_obj,theta,F,E,I,x,y)
f=sqrt(F(1)^2+F(2)^2);
du(1)= s_obj*cos(theta);
du(2)= s_obj*sin(theta);
du(3)= s_obj*((g_tag(s_obj,theta)*h_taggaim(s_obj,theta)-h_tag(s_obj,theta)*g_taggaim(s_obj,theta))...
/((g_tag(s_obj,theta)^2)+(h_tag(s_obj,theta))^2)^(3/2))...
+(s_obj*f)/(E*I)*((x_obj-x)*cos(theta_obj)+(y_obj-y)*sin(theta_obj));
du(4)= 0;
du(5)= 0;
du(6)= 0;
du(7)= 0; du=du';
end
function res=bc(u0,u,s_obj,x0,y0,theta_obj,theta0,F,E,I,x1,y1)
res=[u0(1)-x0
u0(2)-y0
u0(3)-theta0
u(1)-x1
u(2)-y1
u(6)-theta_obj
u(7)-s_obj]';
end
function a=g_tag(s_obj,theta)
a=s_obj*cos(theta) ;
end
function b=g_taggaim(s_obj,theta)
b=-s_obj*sin(theta);
end
function aa=h_tag(s_obj,theta)
aa=s_obj*sin(theta);
end
function bb=h_taggaim(s_obj,theta)
bb=s_obj*cos(theta);
end
Thanks!
10 commentaires
Stephan
le 3 Juin 2020
Karin, we could dicuss this here for the next years... F should be a vector of length 2, there are also other issues. Why not just post the complete code that you use and that produces the error? Why are you making it that hard?
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!