szwstar815 发表于 2008-3-8 17:43

求助打靶法程序出错问题

我编了一个程序,如下:
function ex1bvp
%The problem is
%   
%      v'' =a*v-v*w
%      w'' = (1/b^2)*(w-0.5*v^2)
%
%   The interval is and the boundary conditions are
%   
%      w(-10) = v(-10) = 0,w(10) = v(10) = 0,
solinit = bvpinit(linspace(-10,10,20),@ex1init);
options = bvpset('Stats','on','RelTol',1e-5);
sol = bvp4c(@ex1ode,@ex1bc,solinit,options);
% The solution at the mesh points
x = sol.x;
y = sol.y;
clf reset
plot(x,y(1,:))
axis auto
xlabel('x')
shg
% --------------------------------------------------------------------------
function dydx = ex1ode(x,y)
%   The components of y correspond to the original variables
%   asy(1) = v, y(2) = v', y(3) = w, y(4) = w'.
a=1;
b=1;
dydx =[ y(2)
         a*y(1)-y(3)*y(1)
         y(4)
         1/b^2*(y(3)-0.5*y(1)^2) ];
%-------------------------------------------------------------------------
function res = ex1bc(ya,yb)
res = [ ya(1)
      ya(2)
      yb(1)
      yb(2)];
%-------------------------------------------------------------------------
function v = ex1init(x)
%EX1INIT guess for problem of the BVP4C.
a=1;
v = [2*sqrt(a)*sech(sqrt(a)*x)
   2*sqrt(a)*sech(sqrt(a)*x)*tanh(sqrt(a)*x)
   2*a*(sech(sqrt(a)*x))^2
   -4*a*(sech(sqrt(a)*x))^2*tanh(sqrt(a)*x)];

运行后,提示如下出错:
??? Error using ==> bvp4c
Unable to solve the collocation equations -- a singular Jacobian encountered
Error in ==> E:\doctor\matlab\BVP_tutorial\BVP_tutorial\BVP_examples\szw1.m
On line 14==> sol = bvp4c(@ex1ode,@ex1bc,solinit,options);

麻烦各位帮忙看一下。

[ 本帖最后由 eight 于 2008-3-10 16:32 编辑 ]

snowmaple 发表于 2008-10-3 09:37

我也遇见相同的问题!

请问下你的问题解决没有啊?我也遇见相同的问题,不知道怎么处理了...
??? Error using ==> bvp4c
Unable to solve the collocation equations -- a singular Jacobian encountered
Error in ==> D:\1JXLKeti(copy)\080815\080613LDM\ExampleBoundaryProblem\nosimplify080830\matlab65bvp4ch.m
On line 4==> sol=bvp4c(@myode,@mybc,sinit,[ ],Bf,k)
Error in ==> D:\1JXLKeti(copy)\080815\080613LDM\ExampleBoundaryProblem\nosimplify080830\diaoyongmatlab65bvp4c.m
On line 10==>    =matlab65bvp4ch(BB,k);
页: [1]
查看完整版本: 求助打靶法程序出错问题