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 rectgrid
4 % class.
5 
6 % Bernard Haasdonk 9.5.2007
7 
8 disp('');
9 disp('initializing grid and different plot modes')
10 params.xrange = [0,1];
11 params.yrange = [0,2];
12 params.xnumintervals = [10];
13 params.ynumintervals = [15];
14 params.verbose = 0;
15 params.bnd_rect_index = [];
16 g1 = rectgrid(params);
17 
18 params.shrink_factor = 0.9;
19 params.plot_patch = 0;
20 params.color = [1,0,0];
21 params.axis_equal = 1;
22 params.axis_tight = 1;
23 subplot(1,2,1), plot(g1,params);
24 title('line, shrink');
25 
26 params.plot_patch = 1;
27 params.shrink_factor = 1.0;
28 params.color = [0,1,0];
29 subplot(1,2,2), plot(g1,params);
30 title('patch, noshrink');
31 
32 disp('press key to continue');
33 pause();
34 
35 disp('');
36 disp('elementdata and vertexdata')
37 
38 figure;
39 d = sqrt(g1.CX.^2+g1.CY.^2);
40 subplot(1,2,1);
41 plot_element_data(g1,d,params);
42 title('element data');
43 
44 dv = sin(((g1.X-0.4).^2+(g1.Y-1.0).^2)*10);
45 subplot(1,2,2);
46 plot_vertex_data(g1,dv,params);
47 title('vertex data');
48 
49 disp('press key to continue');
50 pause();
51 
52 
53 disp('');
54 disp('sequence of data, please move slider')
55 
56 params.title = 'vertex data sequence';
57 params.colorbar_location = 'WestOutside';
58 ndata = 100;
59 dv = zeros(g1.nvertices,ndata);
60 for d = 1:ndata
61  dv(:,d) = sin(((g1.X-0.4-0.5*d/ndata).^2+(g1.Y-1.0-0.2*d/ndata).^2)*10);
62 end;
63 params.plot = @plot_vertex_data;
64 plot_sequence(dv,g1,params);
65 
66 disp('press key to continue');
67 pause();
68 
69 
70 disp(' ');
71 disp('demonstration of grid inspect')
72 
73 inspect(g1);
74 
75 disp('press key to continue');
76 pause();
77 
78 disp(' ');
79 disp('display method of grid:')
80 display(g1);
81 
function r = verbose(level, message, messageId)
This function displays messages depending on a message-id and/or a level. Aditionally you can set/res...
Definition: verbose.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
A cartesian rectangular grid in two dimensions with axis parallel elements.
Definition: rectgrid.m:17