exp.m
来自「matlab波形优化算法经常要用到的matlab toolbox工具箱:yalm」· M 代码 · 共 51 行
M
51 行
function varargout = exp(varargin)
%EXP (overloaded)
% Author Johan L鰂berg
% $Id: exp.m,v 1.28 2008/02/12 12:51:06 joloef Exp $
switch class(varargin{1})
case 'double'
error('Overloaded SDPVAR/EXP CALLED WITH DOUBLE. Report error')
case 'sdpvar'
varargout{1} = InstantiateElementWise(mfilename,varargin{:});
case 'char'
operator = struct('convexity','convex','monotonicity','increasing','definiteness','positive','model','callback');
operator.convexhull = @convexhull;
operator.bounds = @bounds;
operator.derivative = @(x)exp(x);
operator.range = [0 inf];
varargout{1} = [];
varargout{2} = operator;
varargout{3} = varargin{3};
otherwise
error('SDPVAR/EXP called with CHAR argument?');
end
% Bounding functions for the branch&bound solver
function [L,U] = bounds(xL,xU)
L = exp(xL);
U = exp(xU);
function [Ax, Ay, b] = convexhull(xL,xU)
fL = exp(xL);
fU = exp(xU);
if fL == fU
Ax = [];
Ay = [];
b = [];
else
dfL = exp(xL);
dfU = exp(xU);
% A cut with tangent parallell to upper bound is very efficient
xM = log((fU-fL)/(xU-xL));
fM = exp(xM);
dfM = exp(xM);
[Ax,Ay,b] = convexhullConvex(xL,xM,xU,fL,fM,fU,dfL,dfM,dfU);
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?