MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB毕业设计] 关于变分不等式投影算法的matlab程序 (https://www.labfans.com/bbs/showthread.php?t=18786)

jacalyn 2013-04-16 13:33

关于变分不等式投影算法的matlab程序
 
主要程序如下(后面关于fun(x)函数太长去掉了),请高手帮忙解读下,从第二个end到第三个end之间的程序? 另外我需要用到这段程序来解自建的模型,有偿求合作。。

function x=Porjection3()
clc
sigama=0.5;
gama=0.8;
x0=[10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 0 0 0 0 0 0 0 0];
x=x0;
fun(x)
z=max_fun(x)
r=(x-z)
t=1

while norm(r)>1e-3
norm(r)
m=0;
f=fun(x);
xx=x-gama^m*r;
ff=fun(xx);
while sum((f-ff).*r)>sigama*norm(r)^2
m=m+1;
xx=x-gama^m*r;
ff=fun(xx);
if m>200
m
break;
end
end
yita=gama^m;
y=(1-yita)*x+yita*z
d=-(yita*r-yita*fun(x)+fun(y))
alfa=yita*sum(r.*(r-fun(x)+fun(y)))/(norm(d)^2)
x=max(0,x+alfa*d)
z=max_fun(x)
r=(x-z)
t=t+1
end


function z=max_fun(x)
f=fun(x);
xx=x-f;
z=max(xx,0);


所有时间均为北京时间。现在的时间是 05:15

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.