2 %
function femo_interpol
3 % Script
using femdiscfunc for interpolating functions by local and
6 % B. Haasdonk, I. Maier 26.04.2011
8 disp(
'-------------------------------');
9 disp(
' FE-interpolation demo ');
10 disp(
'-------------------------------');
17 params.numintervals = 5;
18 % model with evaluations via global coordinates
19 model = poisson_model(params);
20 % convert to model allowing local grid evaluations:
22 grid = construct_grid(model);
23 %tmp = load(
'circle_grid');
25 disp(
'model initialized');
27 % interpolate exact solution and other coefficient functions
28 % as fem-
function and plot
30 disp(
'examples of interpolation of analytical functions:');
34 df = fem_interpol_global(model.solution, df);
36 title(
'analytical solution');
38 % discretize source
function and plot
40 %df = fem_interpol_local(model.source, df);
41 df = fem_interpol_global(model.source, df);
43 title(
'source function');
45 % interpolation of
explicit inline function x^2+y^2:
46 f = @(glob,params) glob(:,1).^2 + glob(:,2).^2;
47 df = fem_interpol_global(f, df);
49 title(
'function handle for x^2+y^2');
51 % interpolation of df in finer fem space:
55 p4_df_info =
feminfo(par,df.grid);
57 df_local_eval = @(grid,elids,lcoord,params) ...
58 fem_evaluate(df,elids,lcoord,[],[]);
59 % my_local_eval(grid,elids,lcoord,params,df);
60 df2 = fem_interpol_local(df_local_eval,df2);
62 title(
'local interpolation of discrete function');
class representing a continous piecewise polynomial function of arbitrary dimension. DOFS correspond to the values of Lagrange-nodes.
A triangular conforming grid in two dimensions.
function local_model = elliptic_discrete_model(model)
function creating a model with local functions out of a model with global functions. See detailed description for explanation.
structure representing the fem-space information shared by all fem-functions. Implemented as handle c...
function demo_interpol()
Script using femdiscfunc for interpolating functions by local and global evaluations.