📄 goalgra.m
字号:
function [gfnew,gn] = goalgra(V,neqcstr,evalstr1,evalstr2,WEIGHT,GOAL,x,P1,P2,P3,P4,P5,P6);
%GOALGRA Utility function to translate gradient in goal-attainment problem.
% Intermediate function used to translate goal attainment
% problem into constrained optimization problem.
% Used by ATTGOAL and CONSTR. See also, GOALFUN.
% Copyright (c) 1990 by the MathWorks, Inc.
% Andy Grace 7-9-90.
nx=length(V)-1;
x(:)=V(1:nx);
lambda=V(nx+1);
gg=[];
eval(evalstr2)
ncstr=length(WEIGHT);
GL = -ones(1,ncstr+neqcstr);
for i=1:ncstr
if WEIGHT(i)~=0
gf(:,i)=gf(:,i)/WEIGHT(i);
if i<=neqcstr,gf(:,i+ncstr)=-gf(:,i); end
else
GL(1,i)=0;
end
end
gfnew=[zeros(nx,1);1];
gn=[gf;GL];
gs=size(gg);
if gs(1)>0, gn=[gn,[gg;zeros(1,gs(2))]]; end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -