hmukai.m

来自「基于matlab的约束非线性规划算法库」· M 代码 · 共 20 行

M
20
字号
function [h, A] = hmukai(x, ctrl)
%Call: [h A]=hmukai(x,ctrl)
%Evaluate both the constraints and the corresponding
%Jacobian if ctrl>0, for the problem below at x
%The problem is defined as h(x)>=0
%
h(1)=-x(1)^2-x(2)^2-x(3)^2+5;
h(2)=-(x(4)-3)^2-x(5)^2+1;
h=h(:);
n=max(size(x));
if ctrl > 0
    A=zeros(2,n);
    A(1,1)=-2*x(1);
    A(1,2)=-2*x(2);
    A(1,3)=-2*x(3);
    A(2,4)=-2*(x(4)-3);
    A(2,5)=-2*x(5);
else
    A=[];
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?