rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
demo_interpol.m
1 function demo_interpol
2 % function femo_interpol
3 %
4 % Script using femdiscfunc for interpolating functions by local and
5 % global evaluations.
6 
7 % B. Haasdonk, I. Maier 26.04.2011
8 
9 disp('-------------------------------');
10 disp(' FE-interpolation demo ');
11 disp('-------------------------------');
12 
13 % poisson_model
14 params = [];
15 pdeg = 4;
16 params.pdeg = pdeg;
17 params.dimrange = 1;
18 params.numintervals = 5;
19 model = poisson_model(params);
20 % convert to local_model:
21 model = elliptic_discrete_model(model);
22 grid = construct_grid(model);
23 %tmp = load('circle_grid');
24 %grid = triagrid(tmp.p,tmp.t,[]);
25 disp('model initialized');
26 
27 % interpolate exact solution and other coefficient functions
28 % as fem-function and plot
29 
30 disp('examples of interpolation of analytical functions:');
31 df_info=feminfo(model,grid);
32 df = femdiscfunc([],df_info);
33 
34 df = fem_interpol_global(model.solution, df);
35 plot(df);
36 title('analytical solution');
37 
38 % discretize source function and plot
39 
40 %df = fem_interpol_local(model.source, df);
41 df = fem_interpol_global(model.source, df);
42 figure,plot(df);
43 title('source function');