silence123 发表于 2012-12-9 22:40

菜鸟求教怎么调对这个程序。。。内点法求极小值x(1)-1)^2+x(2)^2 x1>=0,x2>=0

function mytest
global x
r(1)=10;
c=0.1;
x0=;
e=0.0001;
for k=1:20
    =fminunc(myfun1,x0);
    if r(k)*(-log(x(1,1))-log(x(2,1)))<= e
        x
        k
        break
    else
        r(k+1)=c*r(k);
    end
end
function f=myfun1(x)
global x r
f=(x(1)-1)^2+x(2)^2-r(k)*log(x(1))-r(k)*log(x(2));
页: [1]
查看完整版本: 菜鸟求教怎么调对这个程序。。。内点法求极小值x(1)-1)^2+x(2)^2 x1>=0,x2>=0