rbmatlab 0.10.01
demos/demo_interpol.m
00001 function demo_interpol
00002 % function femo_interpol
00003 %
00004 % Script using femdiscfunc for interpolating functions by local and
00005 % global evaluations.
00006 
00007 % B. Haasdonk, I. Maier 26.04.2011
00008 
00009 disp('-------------------------------');
00010 disp('     FE-interpolation demo     ');
00011 disp('-------------------------------');
00012 
00013 % poisson_model
00014 params = [];
00015 pdeg = 4;
00016 params.pdeg = pdeg;
00017 params.dimrange = 1;
00018 params.numintervals = 5;
00019 model = poisson_model(params);
00020 % convert to local_model:
00021 model = elliptic_discrete_model(model);
00022 grid = construct_grid(model);
00023 %tmp = load('circle_grid');
00024 %grid = triagrid(tmp.p,tmp.t,[]);
00025 disp('model initialized');
00026 
00027 % interpolate exact solution and other coefficient functions 
00028 % as fem-function and plot
00029 
00030 disp('examples of interpolation of analytical functions:');
00031 df_info=feminfo(model,grid);
00032 df = femdiscfunc([],df_info);
00033 
00034 df = fem_interpol_global(model.solution, df);  
00035 plot(df);
00036 title('analytical solution');
00037 
00038 % discretize source function and plot
00039 
00040 %df = fem_interpol_local(model.source, df);
00041 df = fem_interpol_global(model.source, df); 
00042 figure,plot(df);
00043 title('source function');
 All Classes Namespaces Files Functions Variables