show2D

PURPOSE ^

% Method of optiGTest class

SYNOPSIS ^

function h=show2D(obj,XX,YY,ZZ,GZ,txt,funName)

DESCRIPTION ^

% Method of optiGTest class
 L. LAURENT --  15/04/2018 -- luc.laurent@lecnam.net

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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 
0025 %% show 2D function
0026 % INPUTS:
0027 %  - XX, YY: meshgrid used for ploting
0028 %  - ZZ, GZ: responses and gradients of 1 or many functions (stored in cell)
0029 %  - txt: text to display in title [optional]
0030 %  - funName: name the functions (stored in cell) [optional]
0031 % OUTPUTS:
0032 %  - h: handle of the figure
0033 
0034 function h=show2D(obj,XX,YY,ZZ,GZ,txt,funName)
0035 nbC=3;
0036 nbLevel=10;
0037 %
0038 if nargin<6;funName{1}='';end
0039 if nargin<5;txt=[];end
0040 %
0041 if iscell(ZZ)
0042     nbR=numel(ZZ)*2;
0043     if numel(funName)==1&&nbR~=1
0044         funName=repmat({''},1,nbR);
0045     end
0046 else
0047     nbR=2;
0048     nbC=3;
0049     %
0050     ZZ={ZZ};
0051     GZ={GZ};
0052 end
0053 %
0054 spaceX=[obj.xMin(1) obj.xMax(1)];
0055 spaceY=[obj.xMin(2) obj.xMax(2)];
0056 %
0057 h=figure('NumberTitle', 'off', 'Name', [txt ' function']);
0058 itS=1;
0059 warning off all;
0060 for itR=1:numel(ZZ)
0061     subplot(nbR,nbC,itS)
0062     surfCustom(XX,YY,ZZ{itR});
0063     axis('tight','square')
0064     xlabel('x'), ylabel('y'), title(funName{itR})
0065     xlim(spaceX)
0066     ylim(spaceY)
0067     %%%%%%%%%%%%%%%%%%%%%%%%%%%%
0068     subplot(nbR,nbC,itS+1)
0069     surfCustom(XX,YY,GZ{itR}(:,:,1));
0070     axis('tight','square')
0071     xlabel('x'), ylabel('y'), title(['Grad. X ' funName{itR}])
0072     xlim(spaceX)
0073     ylim(spaceY)
0074     %%%%%%%%%%%%%%%%%%%%%%%%%%%%
0075     subplot(nbR,nbC,itS+2)
0076     surfCustom(XX,YY,GZ{itR}(:,:,2));
0077     axis('tight','square')
0078     xlabel('x'), ylabel('y'), title(['Grad. Y ' funName{itR}])
0079     xlim(spaceX)
0080     ylim(spaceY)
0081     %%%%%%%%%%%%%%%%%%%%%%%%%%%%
0082     subplot(nbR,nbC,itS+3)
0083     contourf(XX,YY,ZZ{itR},nbLevel);
0084     axis('tight','square')
0085     xlabel('x'), ylabel('y'), title(funName{itR})
0086     xlim(spaceX)
0087     ylim(spaceY)
0088     %%%%%%%%%%%%%%%%%%%%%%%%%%%%
0089     subplot(nbR,nbC,itS+4)
0090     contourf(XX,YY,GZ{itR}(:,:,1),nbLevel);
0091     axis('tight','square')
0092     xlabel('x'), ylabel('y'), title(['Grad. X ' funName{itR}])
0093     xlim(spaceX)
0094     ylim(spaceY)
0095     %%%%%%%%%%%%%%%%%%%%%%%%%%%%
0096     subplot(nbR,nbC,itS+5)
0097     contourf(XX,YY,GZ{itR}(:,:,2),nbLevel);
0098     axis('tight','square')
0099     xlabel('x'), ylabel('y'), title(['Grad. Y ' funName{itR}])
0100     xlim(spaceX)
0101     ylim(spaceY)
0102     %
0103     itS=itS+6;
0104 end
0105 warning on all;
0106 end

Generated on Tue 28-May-2019 16:00:34 by m2html © 2005