Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Why do i receive the following error: a singular Jacobian encountered while using the MATLAB function bvp4c

1 回表示 (過去 30 日間)
Jelle ter Braak
Jelle ter Braak 2016 年 6 月 21 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I'm trying to solve a system of fifteen first order ordiantry differential equations. When running i receive the following error: Unable to solve the collocation equations -- a singular Jacobian encountered.
I think my error is due to the choosing of the initial values: I'm not sure how to select these.
My code is the following:
solinit = bvpinit(linspace(0,14,15),@init);
sol = bvp4c(@ode,@bc,solinit);
function [dydx] = ode(x,y)
% First order differential equations
% for a simple wire hockling mechanism
% y(1) = x, y(2) = y, y(3) = z, y(4) = d1x, y(5) = d1y, y(6) = d1z,
% y(7) = d3x, y(8) = d3y, y(9) = d3z, y(10) = N1, y(11) = N2
% y(12) = N3, y(13) = M1, y(14) = M2, y(15) = M3
dydx = [y(7)
y(8)
y(9)
y(14)/0.0028*((y(7)*y(6)-y(9)*y(4))*y(6)-(y(7)*y(5)-y(8)*y(4))*y(5))+y(15)/0.0020*(y(8)*y(6)-y(9)*y(5))
y(14)/0.0028*((y(8)*y(6)-y(9)*y(5))*y(6)-(y(7)*y(5)-y(8)*y(4))*y(4))+y(15)/0.0020*(y(7)*y(6)-y(9)*y(4))
y(14)/0.0028*((y(8)*y(6)-y(9)*y(5))*y(5)-(y(7)*y(6)-y(9)*y(4))*y(4))+y(15)/0.0020*(y(7)*y(5)-y(8)*y(4))
y(13)/0.0028*(y(5)*y(9)-y(8)*y(6))+y(14)/0.0028*((y(7)*y(6)-y(9)*y(4))*y(9)-y(8)*(y(7)*y(5)-y(8)*y(4)))
y(13)/0.0028*(y(4)*y(9)-y(7)*y(6))+y(14)/0.0028*((y(8)*y(6)-y(9)*y(5))*y(9)-y(7)*(y(7)*y(5)-y(8)*y(4)))
y(13)/0.0028*(y(4)*y(8)-y(7)*y(5))+y(14)/0.0028*((y(8)*y(6)-y(9)*y(5))*y(8)-y(7)*(y(7)*y(6)-y(9)*y(4)))
y(11)*y(15)/0.0020-y(12)*y(14)/0.0028
y(12)*y(13)/0.0028-y(10)*y(15)/0.0020
y(10)*y(14)/0.0028-y(11)*y(13)/0.0020
y(14)*y(15)/0.0028*(1-0.0028/0.0020)+y(11)
y(13)*y(15)/0.0028*(1-0.0028/0.0020)-y(10)
0];
end
function [res] = bc(ya,yb)
% Boundary conditions are described here
% y(1) = x, y(2) = y, y(3) = z, y(4) = d1x, y(5) = d1y, y(6) = d1z,
% y(7) = d3x, y(8) = d3y, y(9) = d3z, y(10) = N1, y(11) = N2
% y(12) = N3, y(13) = M1, y(14) = M2, y(15) = M3
res = [ya(1)
ya(2)
ya(3)
ya(4)-1
ya(5)
ya(6)
ya(7)
ya(8)
ya(9)-1
yb(1)
yb(2)
yb(3)-(500-10)
yb(4)-cos(0)
yb(7)
yb(8)];
end
function [v] = init(x)
% Guess
v = [0
0
0
1
0
0
0
0
1
1
1
1
1
1
0];
end
My functions are in seperate files, for easy visibility they are shown in a single file here. This should not be the problem.

回答 (0 件)

この質問は閉じられています。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by