Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Error using bvp4c (singular jacobian encountered)

1 visualización (últimos 30 días)
Karin Dekel
Karin Dekel el 26 de Mayo de 2020
Cerrada: Karin Dekel el 3 de Jun. de 2020
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 comentarios
Stephan
Stephan el 3 de Jun. de 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?
Karin Dekel
Karin Dekel el 3 de Jun. de 2020
well, there was no intention of making this hard.
i will delete this and open a new question where i'll include the whole file.
thank you

Respuestas (0)

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by