MESH toolbox  0.1
Matlab/Octave mesh utils
 All Files Functions Groups Pages
graphic_demo1.m
Go to the documentation of this file.
1 function graphic_demo1(varargin)
2 % function graphic_demo1
3 % code using basic mesh plot command.
4 %
5 % Parameters:
6 % save : set to true to save figures in image directory.
7 % percent : set color mesh lines
8 % meshfile : set mesh file name
9 %
10 % Examples:
11 % @verbatim graphic_demo1('save',true,'percent',30)@endverbatim
12 % \image html images/PlotMesh.png "figure(1) : PlotMesh(Th,\'Color\',[1 0 0],\'LineWidth\',1);"
13 % \image html images/PlotBounds.png "figure(2) : PlotBounds(Th,\'LineWidth\',2);"
14 % \image html images/PlotBoundsAndMesh.png "figure(3) : PlotMesh and PlotBounds"
15 % \image html images/PlotVal.png "figure(4) : PlotVal(Th,u,\'colormap\',\'Cool\');"
16 %
17 % See also:
19 p = inputParser;
20 %
21 p.addParamValue('save', false, @islogical );
22 p.addParamValue('percent', 50 , @(t) ((t>0)&&(t<=100)) );
23 p.addParamValue('meshfile',['mesh',filesep,'disque4-1-10.msh'], @isstr );
24 p.parse(varargin{:});
25 
26 close all
27 
28 addpath('base');
29 addpath('graphic');
30 Th=GetMeshOpt(p.Results.meshfile);
31 
32 figure(1)
33 PlotMesh(Th,'Color',[1 0 0],'LineWidth',1);
34 SaveImage(p.Results.save,'PlotMesh',p.Results.percent)
35 title(['Filename : ',p.Results.meshfile])
36 
37 
38 figure(2)
39 RGBcolors=PlotBounds(Th,'LineWidth',2);
40 SaveImage(p.Results.save,'PlotBounds',p.Results.percent)
41 title('Representation des frontieres du domaine')
42 
43 figure(3)
44 PlotMesh(Th,'Color',[0 0 0]);
45 PlotBounds(Th,'colormap','spring','LineWidth',2,'RGBcolors',RGBcolors);
46 SaveImage(p.Results.save,'PlotBoundsAndMesh',p.Results.percent)
47 title('Representation du domaine et de ses frontieres')
48 
49 
50 % Representation d'une <fonction> sur un maillage
51 x=Th.q(1,:);y=Th.q(2,:);
52 k=pi;
53 u=cos(k*(x.^2+y.^2));
54 
55 figure(4)
56 PlotVal(Th,u,'colormap','Cool');
57 SaveImage(p.Results.save,'PlotVal',p.Results.percent)
58 
59 title('Representation de la fonction cos(pi*(x*x+y*y))')
60 axis off
61 
62 figure(5)
63 [colors,values]=PlotIso(Th.q,Th.me,Th.be,u,15);
64 colorbarIso(colors,values)
65 axis off
66 title('Iso valeurs de la fonction cos(pi*(x*x+y*y))')
67 
68 
69 figure(6)
70 trisurf(Th.me',Th.q(1,:),Th.q(2,:),u)
71 %colormap('cool')
72 colorbar
73 shading interp