function compare ( node_num, node_xy, indx, nunk, f ) %% COMPARE compares the exact and computed solution at the nodes. % % Discussion: % % This is a rough comparison, done only at the nodes. Such a pointwise % comparison is easy, because the value of the finite element % solution is exactly the value of the finite element coefficient % associated with that node. % % Modified: % % 17 May 2005 % % Parameters: % % Input, integer NODE_NUM, the number of nodes. % % Input, real NODE_XY(2,NODE_NUM), the nodes. % % Input, integer INDX(NODE_NUM), the index of the unknown in the % finite element linear system. % % Input, integer NUNK, the number of unknowns in the finite element system. % % Input, real F(NUNK), the solution vector of the finite % element system. % fprintf ( 1, '\n' ); fprintf ( 1, 'COMPARE:\n' ); fprintf ( 1, ' Compare computed and exact solutions at the nodes.\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' X Y U U\n' ); fprintf ( 1, ' computed exact\n' ); fprintf ( 1, '\n' ); for node = 1 : node_num x = node_xy(1,node); y = node_xy(2,node); [ u, dudx, dudy ] = exact ( x, y ); i = indx(node); uh = f(i); fprintf ( 1, '%12f %12f %12f %12f\n', x, y, uh, u ); end