lagrpen.m
来自「various matlab programs to slove various」· M 代码 · 共 14 行
M
14 行
function [x,vinc,nit]=lagrpen(x0,alpha0,beta,f,h,toll)x = x0; [r,c]=size(h); vinc = 0;for i=1:r, vinc = max(vinc,eval(h(i,1:c))); endnorm2h=['(',h(1,1:c),')^2'];for i=2:r, norm2h=[norm2h,'+(',h(i,1:c),')^2']; endalpha = alpha0; options(1)=0; options(2)=toll*0.1; nit = 0;while vinc > toll g=[f,'+0.5*',num2str(alpha,16),'*',norm2h]; [x]=fmins(g,x,options); vinc=0; nit = nit + 1; for i=1:r, vinc = max(vinc,eval(h(i,1:c))); end alpha=alpha*beta;endreturn
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?