两句程序:
》a=inline('x(1)+(x(2))^2/(4*x(1))+(x(3))^2/(x(2))+2/(x(3)','x');
》[x,fval]=fminsearch(a,[0.5,0.5,0.5])
目的求a=x+y^2/4x+z^2/y+2/z,在(0.5,0.5,0.5)附近的最小值;
错误提示:
??? Error using ==> inlineeval at 15Error in inline expression ==> x(1)+(x(2))^2/(4*x(1))+(x(3))^2/(x(2))+2/(x(1)
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.
Error in ==> inline.subsref at 27 INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in ==> fminsearch at 195fv(:,1) = funfcn(x,varargin{:});
Error in ==> h10015 at 2[x,fval]=fminsearch(a,[0.5,0.5,0.5])
》a=inline('x(1)+(x(2))^2/(4*x(1))+(x(3))^2/(x(2))+2/(x(3)','x');
》[x,fval]=fminsearch(a,[0.5,0.5,0.5])
目的求a=x+y^2/4x+z^2/y+2/z,在(0.5,0.5,0.5)附近的最小值;
错误提示:
??? Error using ==> inlineeval at 15Error in inline expression ==> x(1)+(x(2))^2/(4*x(1))+(x(3))^2/(x(2))+2/(x(1)
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.
Error in ==> inline.subsref at 27 INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in ==> fminsearch at 195fv(:,1) = funfcn(x,varargin{:});
Error in ==> h10015 at 2[x,fval]=fminsearch(a,[0.5,0.5,0.5])