rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
eop_fd_norm.m
Go to the documentation of this file.
1 function norm = eop_fd_norm(fd_function1, fd_function2, grid, ~)
2 %norm = eop_fd_norm(fd_function1, fd_function2, grid, ~)
3 %
4 % function that computes the discrete L2-norm of the error ||fd_function1 -
5 % fd_function2|| in every timestep, i.e. a sequence. Choose one of the
6 % functions to be zero in order to recieve the norm of a single function.
7 
8 % fd_function1 and fd_function2 have to have the same size and they are
9 % assumed to be in matrix-form, i.e. one column represents the function in
10 % one timeslice.
11 
12 % grid is for example model_data.grid
13 
14 % Dominik Garmatter 10.04 2012
15 
16 A = speye(grid.nvertices)*1/grid.nvertices; % mass matrix of the discrete L2-SP
17 C = fd_function1-fd_function2;
18 norm = zeros(1,size(C,2));
19 
20 for i = 1:size(C,2)
21  skalarproduct = C(:,i)'*A*C(:,i);
22  norm(1,i) = sqrt(skalarproduct);
23 end
function norm = eop_fd_norm(fd_function1, fd_function2,gridbase grid, unused1)
norm = eop_fd_norm(fd_function1, fd_function2, grid, ~)
Definition: eop_fd_norm.m:17