rbmatlab 0.10.01
|
00001 function demo(dummy) 00002 % function demo(dummy) 00003 % small script demonstrating the possibilities of the .triagrid class. 00004 % 00005 00006 % Bernard Haasdonk 9.5.2007 00007 00008 disp(''); 00009 disp('initializing grid by point list and triangles-vertex list'); 00010 load('demoinit.mat'); 00011 params = []; 00012 g1 = triagrid(p,t,params); 00013 00014 params.shrink_factor = 0.9; 00015 params.plot_patch = 0; 00016 params.color = [1,0,0]; 00017 params.axis_equal = 1; 00018 subplot(1,2,1), plot(g1,params); 00019 title('line, shrink'); 00020 00021 params.plot_patch = 1; 00022 params.shrink_factor = 1.0; 00023 params.color = [0,1,0]; 00024 subplot(1,2,2), plot(g1,params); 00025 title('patch, noshrink'); 00026 00027 disp('press key to continue'); 00028 pause(); 00029 00030 disp(''); 00031 disp('elementdata and vertexdata') 00032 00033 figure; 00034 d = sqrt(g1.CX.^2+g1.CY.^2); 00035 subplot(1,2,1); 00036 plot_element_data(g1,d,params); 00037 title('element data'); 00038 00039 dv = sin(((g1.X-0.4).^2+(g1.Y-1.0).^2)*10); 00040 subplot(1,2,2); 00041 plot_vertex_data(g1,dv,params); 00042 title('vertex data'); 00043 00044 disp('press key to continue'); 00045 pause(); 00046 00047 00048 disp(''); 00049 disp('sequence of data, please move slider') 00050 00051 params.title = 'vertex data sequence'; 00052 params.colorbar_location = 'WestOutside' 00053 ndata = 100; 00054 dv = zeros(g1.nvertices,ndata); 00055 for d = 1:ndata 00056 dv(:,d) = sin(((g1.X-0.4-0.5*d/ndata).^2+(g1.Y-1.0-0.2*d/ndata).^2)*10); 00057 end; 00058 params.plot = @plot_vertex_data; 00059 plot_sequence(dv,g1,params); 00060 00061 disp('press key to continue'); 00062 pause(); 00063 00064 00065 disp(' '); 00066 disp('demonstration of grid inspect') 00067 00068 inspect(g1); 00069 00070 disp('press key to continue'); 00071 pause(); 00072 00073 disp(' '); 00074 disp('display method of grid:') 00075 display(g1); 00076