% Method of optiGTest class L. LAURENT -- 15/04/2018 -- luc.laurent@lecnam.net
0001 %% Method of optiGTest class 0002 % L. LAURENT -- 15/04/2018 -- 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) 2018 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 %% show 1D function 0025 % INPUTS: 0026 % - XX: abscissa used for ploting 0027 % - ZZ, GZ: responses and gradients of 1 or many functions (stored in cell) 0028 % - txt: text to display in title [optional] 0029 % - funName: name the functions (stored in cell) [optional] 0030 % OUTPUTS: 0031 % - h: handle of the figure 0032 0033 0034 function h=show1D(obj,XX,ZZ,GZ,txt,funName) 0035 nbR=1; 0036 nbC=2; 0037 if nargin<6;funName=[];end 0038 if nargin<5;txt=[];end 0039 % 0040 if iscell(ZZ) 0041 nbR=numel(ZZ); 0042 else 0043 ZZ={ZZ}; 0044 GZ={GZ}; 0045 end 0046 % 0047 spaceX=[obj.xMin obj.xMax]; 0048 % 0049 h=figure('NumberTitle', 'off', 'Name', [txt ' function']); 0050 itS=1; 0051 for itR=1:nbR 0052 subplot(nbR,nbC,itS) 0053 plot(XX,ZZ{itR}); 0054 axis('tight','square') 0055 xlabel('x'), ylabel('F'), title(funName{itR}) 0056 xlim(spaceX) 0057 subplot(nbR,nbC,itS+1) 0058 plot(XX,GZ{itR}(:,:,1)); 0059 axis('tight','square') 0060 xlabel('x'), ylabel('dF/dx'), title(['Grad. ' funName{itR}]) 0061 xlim(spaceX) 0062 itS=itS+2; 0063 end 0064 end