高手帮忙分析下(关于matcont的一个问题) 不会占用您多少时间的 谢谢!
我完全按照matcont的manual上平衡点的那个例子(bratu) 但是matlab还是报错:>> =init_EP_EP(@bratu,,p,ap);
??? Error: File: bratu.m Line: 48 Column: 1
The function "bratu" was closed
with an 'end', but at least one other function definition was not.
To avoid confusion when using nested functions,
it is illegal to use both conventions in the same file.
Error in ==> init_EP_EP at 15
func_handles = feval(odefile);
去掉end后 这项命令可以运行了
但是到最后一步又报错:
>> =cont(@equilibrium,x0,[],opt);
??? Error using ==> feval
Argument must contain a string or function_handle.
Error in ==> cjacp at 11
j = feval(jacobianp, 0, x, p{:});
Error in ==> equilibrium>jacobian at 29
jac = ;
Error in ==> cjac at 52
j = feval(jacobian,x);
Error in ==> newtcorr at 14
B = ); v'];
Error in ==> cont>CorrectStartPoint at 753
= newtcorr(x0, v0);
Error in ==> cont at 208
= CorrectStartPoint(x0, v0);
附程序:bratu.m
function out =bratu
out{1}=@init;
out{2}=@fun_eval;
out{3}=@jacobian;
out{4}=[];
out{5}=@hessians;
out{6}=@hessiansp;
out{7}=[];
out{8}=[];
out{9}=[];
out{10}=@userf1;
end
%-----------------------------------------------------------
function dydt=fun_eval(t,kmrgd,a)
dydt=[-2*kmrgd(1)+kmrgd(2)+a*exp(kmrgd(1));
kmrgd(1)-2*kmrgd(2)+a*exp(kmrgd(2))];
%-----------------------------------------------------------
function =init
tspan=;
y0=;handles=feval(@bratu)
options=odeset('Jacobian',handles(3),'JacobianP','handles(4)','Hessians',handles(5),'Hessiansp',handles(6));
%-----------------------------------------------------------
function jac=jacobian(t,kmrgd,a)
jac=[-2+a*exp(kmrgd(1))1
1 -2+a*exp(kmrgd(2)) ];
%-----------------------------------------------------------
function jacp=jacobianp(t,kmrgd,a)
jacp=[exp(kmrgd(1))
exp(kmrgd(2))];
%-----------------------------------------------------------
function hess=hessians(t,kmrgd,a)
hess1=[;];
hess2=[;];
hess(:,:,1)=hess1;
hess(:,:,2)=hess2;
%-----------------------------------------------------------
function hessp=hessiansp(t,kmrgd,a)
hessp1=[;];
hessp(:,:,1)=hessp1;
%-----------------------------------------------------------
function userfun1=userf1(t,kmrgd,a)
userfun1=a-0.2;
应该输入的命令行:
>> global cds
>> p=0;ap=1;
>> =init_EP_EP(@bratu,,p,ap);
>> opt=contset;opt=contset(opt,'MaxNumPoints',50);
>> opt=contset(opt,'Singularities',1);
>> opt=contset(opt,'Userfunctions',1);
>> UserInfo.name='userf1';UserInfo.state=1;UserInfo.label='u1';
>> opt=contset(opt,'UserfunctionsInfo',UserInfo);
>> =cont(@equilibrium,x0,[],opt);
我是新手 有愿意和我讨论的 请加我qq
qq:652491109:@) 有没有会的啊 感谢了!!! 帮下忙啊 我调了好几个例子 都报错 哪位达人帮我看看哪里还需要改下的啊 谢谢了
页:
[1]