rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fv_l1l2_error.m
1 function l1l2_error = fv_l1l2_error(U1,U2,W,params)
2 %function l1l2_error = fv_l1l2_error(U1,U2,W,params)
3 %
4 % function computing the l1([0,T],l2)-error between the two
5 % fv-functions or function
6 % sequences in U1,U2. Result is a single value or sequence of values
7 % corresponding to the column-differences between U1 and U2
8 % correct Omega-integrals are computed by respecting the cell-areas
9 % defined in grid,params. Params defines the time-spacing for
10 % correct time integration
11 %
12 % note, that the last snapshot does not contribute to the error,
13 % as FV functions are assumed to be piecewise constant on a forward
14 % time-intervall.
15 
16 % Bernard Haasdonk 7.11.2008
17 
18 % l2_error = sqrt(sum(((U1-U2).^2).*repmat(grid.A(:),1,size(U1,2))));
19 %A = sparse(1:size(U1,1),1:size(U1,1),grid.A(:));
20 linf_l2_error = sqrt(sum(W * ((U1-U2).^2)));
21 l1l2_error = cumsum(linf_l2_error * params.T/params.nt);
22 l1l2_error = [0,l1l2_error(1:end-1)];%| \docupdate