请问这个matlab程序错在哪里? 5
function[x,y]=flow(f,a,b,e)x1=a;x2=b;Q=fsxhesse(f,x1,x2);x0=[x1x2]';fx1=diff(f,'x1');...
function [x,y]=flow(f,a,b,e)
x1=a;
x2=b;
Q=fsxhesse(f,x1,x2);
x0=[x1 x2]';
fx1=diff(f,'x1');
fx2=diff(f,'x2');
g=[fx1 fx2]';
g1=subs(g);
d=-g1;
while (abs(norm(g1))>e)
t=(-d)'*d/((-d)'*Q*d);
x0=x0-t*g1;
v=x0;
a=[1 0]*x0;
b=[0 1]*x0;
x1=a;
x2=b;
g1=subs(g);
d=-g1;
end
x=v;
y=feval(f,v);
调用程序后显示
??? Error using ==> feval
Argument must contain a string or function_handle.
Error in ==> flow at 23
y=feval(f,v);
请问要怎么改? 展开
x1=a;
x2=b;
Q=fsxhesse(f,x1,x2);
x0=[x1 x2]';
fx1=diff(f,'x1');
fx2=diff(f,'x2');
g=[fx1 fx2]';
g1=subs(g);
d=-g1;
while (abs(norm(g1))>e)
t=(-d)'*d/((-d)'*Q*d);
x0=x0-t*g1;
v=x0;
a=[1 0]*x0;
b=[0 1]*x0;
x1=a;
x2=b;
g1=subs(g);
d=-g1;
end
x=v;
y=feval(f,v);
调用程序后显示
??? Error using ==> feval
Argument must contain a string or function_handle.
Error in ==> flow at 23
y=feval(f,v);
请问要怎么改? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询