% Trigonometric 2 function L. LAURENT -- 23/02/2017 -- luc.laurent@lecnam.net
0001 %% Trigonometric 2 function 0002 % L. LAURENT -- 23/02/2017 -- luc.laurent@lecnam.net 0003 0004 % sources available here: 0005 % https://bitbucket.org/luclaurent/optigtest/ 0006 % https://github.com/luclaurent/optigtest/ 0007 0008 % optiGTest - set of testing functions A toolbox to easy manipulate functions. 0009 % Copyright (C) 2017 Luc LAURENT <luc.laurent@lecnam.net> 0010 % 0011 % This program is free software: you can redistribute it and/or modify 0012 % it under the terms of the GNU General Public License as published by 0013 % the Free Software Foundation, either version 3 of the License, or 0014 % (at your option) any later version. 0015 % 0016 % This program is distributed in the hope that it will be useful, 0017 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0018 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0019 % GNU General Public License for more details. 0020 % 0021 % You should have received a copy of the GNU General Public License 0022 % along with this program. If not, see <http://www.gnu.org/licenses/>. 0023 0024 %1 minimum global: f(0.9,...,0.9)=1 0025 % 0026 %Design space -500<xi<500 (focus on 0<xi<2) 0027 0028 0029 function [p,dp] = funTrigonometric2(xx) 0030 0031 %constants 0032 a=1; 0033 b=8; 0034 c=7; 0035 d=0.9; 0036 e=6; 0037 f=14; 0038 0039 %evaluation and derivatives 0040 xd=xx-d; 0041 xd2=xd.^2; 0042 scx=sin(c*xd2); 0043 sfx=sin(f*xd2); 0044 % 0045 pa=b*scx.^2;%+e*sfx.^2+xd2; 0046 % 0047 p=a+sum(pa,3); 0048 0049 if nargout==2 0050 % 0051 ccx=cos(c*xd2); 0052 cfx=cos(f*xd2); 0053 % 0054 dp=4*b*c*xd.*ccx.*scx; ... 0055 +4*e*f*xd.*cfx.*sfx ... 0056 +2*xd; 0057 end 0058 end