A standardized format MATLAB function instance mountain Bang Bang child army @ 07-20 10: 58function visfem% Main: Set up data to demonstrate usage of 'visfem'% visfem:. Visualises linear finite element functions on unstructered% triangular grids or bilinears on rectangular grids by different% methods% Usage:.. Some redefined grids and functions given own grids may be% referenced below ( 'gridbsp'), own functions declared in 'func_u'% ( 'bsp')% Input:. ... ...........% Output: ............% Author: W. doerfler, UNIV. Karlsruhe.% Last Modified:% 03.03.2002, W. Doerfler. Matlab 6.1.0450. Clear; Format Compact; Format Short E; %%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Global Definitions %%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%% BSP = 1;% Implement Example (Data, See Func_u.m) GridBSP = 1;% Macro Discretisation (See Switch Below) graph0 = 1;% TYPE OF GRAPHICAL OUTPUT:% 1 (2) = (s) graph, 3 (4) = (c) Mesh, 5 = level, 6 = grad %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% LOAD Geometry DATA %%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Switch Gridbsp Case {1, 2}% 1 = 1-Ball, 2 = 1 / 2-1-Annulus Triangulate Macrogrid (Gridbs); Case 3% A Simple Rectangular Example Coord = [0 0; 1 0; 1 1 ; 0 1; 1 0.5;
0.5 1; 0 0.5; 0.5 0; 0.5 0.5]; NODES = [1 8 9 7; 8 2 5 9; 9 5 3 6; 7 9 6 4];% Case 4% Your Data Might Be INSERTED HeRE% COORD = ?% Nodes =? Otherwise Disp ('*** error *** no such method'); end; %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Show The macro-discretisation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%% IF (graph0> 0) show_macro (nodes, coord); End; %%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%% Fill in The VALUES for 'u' %%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% VISUALISE 'u' %%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VisFem ( Graph0, u, nodes, coord; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%% FPRINTF ('the end / n'); Source:
Http://genial.yculblog.com/post-86636.html