testFUN

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 close all
0002 clear all
0003 save_pdf=false;
0004 nb_pts=80;
0005 borne=2.048;
0006 x=linspace(-borne,borne,nb_pts);
0007 y=linspace(-borne,borne,nb_pts);
0008 [X,Y]=meshgrid(x,y);
0009 fct='ackley';
0010 XX(:,:,1)=X;
0011 XX(:,:,2)=Y;
0012 [Z,GZ]=feval(['fct_' fct],XX);
0013 GZ1=GZ(:,:,1);
0014 GZ2=GZ(:,:,2);
0015 figure;surfc(X,Y,Z)
0016 xlabel('x_1')
0017 ylabel('x_2')
0018 zlabel('Z (log)')
0019 %colormap('Spring')
0020 set(gca, 'ZScale', 'log')
0021 hlight=light;               % switch light
0022  lighting('phong')         % rendering
0023  lightangle(hlight,48,70)    % light direction
0024  %colorbar
0025  if save_pdf;print(gcf, '-dpdf', '-r300', ['fig/fct_' fct 'log.pdf']);end
0026 
0027 figure;surfc(X,Y,Z)
0028 xlabel('x_1')
0029 ylabel('x_2')
0030 zlabel('Z')
0031 %shading interp
0032 
0033  hlight=light;               % switch light
0034  lighting('phong')         % rendering
0035  lightangle(hlight,48,70)    % light direction
0036 %colorbar
0037  if save_pdf;print(gcf, '-dpdf', '-r300', ['fig/fct_' fct '.pdf']);end
0038 figure;surfc(X,Y,GZ1)
0039 xlabel('x_1')
0040 ylabel('x_2')
0041 zlabel('GZ1')
0042 %shading interp
0043 hlight=light;               % switch light
0044 lighting('phong')         % rendering
0045 lightangle(hlight,48,70)    % light direction
0046 %colorbar
0047  if save_pdf;print(gcf, '-dpdf', '-r300', ['fig/dfct_' fct '1.pdf']);end
0048 figure;surfc(X,Y,GZ2)
0049 xlabel('x_1')
0050 ylabel('x_2')
0051 zlabel('GZ2')
0052 %shading interp
0053 hlight=light;               % switch light
0054 lighting('phong')         % rendering
0055 lightangle(hlight,48,70)    % light direction
0056 %colorbar
0057 if save_pdf;print(gcf, '-dpdf', '-r300', ['fig/dfct_' fct '2.pdf']);end
0058 pause
0059 
0060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0061 figure;meshc(X,Y,Z)
0062 xlabel('x_1')
0063 ylabel('x_2')
0064 zlabel('Z')
0065 set(gca, 'ZScale', 'log')
0066 %colorbar
0067  if save_pdf;print(gcf, '-dpdf', '-r300', ['fig/fct_' fct 'log_mesh.pdf']);end
0068 
0069 figure;meshc(X,Y,Z)
0070 xlabel('x_1')
0071 ylabel('x_2')
0072 zlabel('Z')
0073 %colorbar
0074  if save_pdf;print(gcf, '-dpdf', '-r300', ['fig/fct_' fct 'mesh.pdf']);end
0075 figure;meshc(X,Y,GZ1)
0076 xlabel('x_1')
0077 ylabel('x_2')
0078 zlabel('GZ1')
0079 
0080 %colorbar
0081  if save_pdf;print(gcf, '-dpdf', '-r300', ['fig/dfct_' fct '1_mesh.pdf']);end
0082 figure;meshc(X,Y,GZ2)
0083 xlabel('x_1')
0084 ylabel('x_2')
0085 zlabel('GZ2')
0086 %colorbar
0087 if save_pdf;print(gcf, '-dpdf', '-r300', ['fig/dfct_' fct '2_mesh.pdf']);end

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