程序通了。
%=========================
function hh
A=[-1,-1];
b=-802;
x0=[735,70];
lb=[730 63];
ub=[740 80];
options = optimset('largescale','off','TolFun',1e-10);
[x,fval,exitflag,output]=fmincon(@myfun,x0,A,b,[],[],lb,ub,[],options)
function f=myfun(x)
f=(x(2)^2+690^2-x(1)^2)/(1380*x(2));
%=============================
结果:x(1)就是x1,x(2)就是x
Optimization terminated: first-order optimality measure less
than options.TolFun and maximum constraint violation is less
than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
2 1
x =
740 63
fval =
-0.7768
exitflag =
1
output =
iterations: 19
funcCount: 60
lssteplength: 1
stepsize: 0
algorithm: 'medium-scale: SQP, Quasi-Newton, line-search'
firstorderopt: 0
message: [1x144 char]
程序执行时workplace中有A变量吗
你确定mpower中的矩阵是方阵吗