⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftp6.m

📁 基于matlab的约束非线性规划算法库
💻 M
字号:
function [f, J] = ftp6(x, ctrl)
%Call: [f J]=ftp6(x,ctrl)
%Evaluate the residuals corresponding
%to the objective in a nonlinear lsq problem.
%If ctrl>0 the Jacobian J is computed analytically.
%Objective: 0.5*norm2(f)
%The problem is defined as
%  min 0.5*norm2(f(x))
%      s.t. c(x)>=0
%See Ex. 6 in Per L.'s disertation (there it is defined as equalities)
%where
%c(1)=x(1)^2+x(2)^2+x(3)^2-25;
%c(2)=8*x(1)+14*x(2)+7*x(3)-56;
%and the lower bounds x(i)>=0 for all i.
%
if ctrl == 0
    sq=sqrt(2);
    f(1)=30-0.05*x(1)^2;
    f(2)=5*sq-9/40/sq*x(2)^2;
    f(3)=5*sq-1/8/sq*x(3)^2;
    f(4)=x(1)-0.5*x(2);
    f(5)=x(1)-0.5*x(3);
    f=f(:);
    J = [];
else
   %The Jacobian is set to the empty matix to indicate that it should
   %be computed using forward differences
    J=[];
    f=[];
end

⌨️ 快捷键说明

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