声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1375|回复: 1

[综合讨论] 求助打靶法程序出错问题

[复制链接]
发表于 2008-3-8 17:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
我编了一个程序,如下:
function ex1bvp
%The problem is
%   
%      v'' =  a*v-v*w
%      w'' = (1/b^2)*(w-0.5*v^2)
%
%   The interval is [0 1] 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
%   as  y(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 编辑 ]
回复
分享到:

使用道具 举报

发表于 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  ==>    [AAA,y0,yy1,yy2,yy3,yy4]=matlab65bvp4ch(BB,k);
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-18 05:03 , Processed in 0.073797 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表