rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
demo.m
1 function demo(dummy)
2 % function demo(dummy)
3 % small script demonstrating the possibilities of the .triagrid class.
4 %
5 
6 % Bernard Haasdonk 9.5.2007
7 
8 disp('');
9 disp('initializing grid by point list and triangles-vertex list');
10 load('demoinit.mat');
11 params = [];
12 g1 = triagrid(p,t,params);
13 
14 params.shrink_factor = 0.9;
15 params.plot_patch = 0;
16 params.color = [1,0,0];
17 params.axis_equal = 1;
18 subplot(1,2,1), plot(g1,params);
19 title('line, shrink');
20 
21 params.plot_patch = 1;
22 params.shrink_factor = 1.0;
23 params.color = [0,1,0];
24 subplot(1,2,2), plot(g1,params);
25 title('patch, noshrink');
26 
27 disp('press key to continue');
28 pause();
29 
30 disp('');
31 disp('elementdata and vertexdata')
32 
33 figure;
34 d = sqrt(g1.CX.^2+g1.CY.^2);
35 subplot(1,2,1);
36 plot_element_data(g1,d,params);
37 title('element data');
38 
39 dv = sin(((g1.X-0.4).^2+(g1.Y-1.0).^2)*10);
40 subplot(1,2,2);
41 plot_vertex_data(g1,dv,params);
42 title('vertex data');
43 
44 disp('press key to continue');
45 pause();
46 
47 
48 disp('');
49 disp('sequence of data, please move slider')
50 
51 params.title = 'vertex data sequence';
52 params.colorbar_location = 'WestOutside';
53 ndata = 100;
54 dv = zeros(g1.nvertices,ndata);
55 for d = 1:ndata
56  dv(:,d) = sin(((g1.X-0.4-0.5*d/ndata).^2+(g1.Y-1.0-0.2*d/ndata).^2)*10);
57 end;
58 params.plot = @plot_vertex_data;
59 plot_sequence(dv,g1,params);
60 
61 disp('press key to continue');
62 pause();
63 
64 
65 disp(' ');
66 disp('demonstration of grid inspect')
67 
68 inspect(g1);
69 
70 disp('press key to continue');
71 pause();
72 
73 disp(' ');
74 disp('display method of grid:')
75 display(g1);
76 
A triangular conforming grid in two dimensions.
Definition: triagrid.m:17
function p = plot_sequence(varargin)
plotting a sequence of data slices on polygonal 2d grid (constructed from params if empty) and provid...
Definition: plot_sequence.m:17