Skip to content
Snippets Groups Projects
Commit 1d2b8ec8 authored by tokies's avatar tokies
Browse files

* Added documentation for plotGridFunction.

* Added error in case of dimension != 2.
parent ab5e26b7
No related branches found
No related tags found
No related merge requests found
function plotGridFunction(grid, basis, u) function plotGridFunction(grid, basis, u)
%plotGridFunction Plots a discrete finite element function.
% WARNING:
% Currently this function only works with the nodal P1/Q1 bases.
%
% Inputs:
% grid Grid of the finite element space.
% basis Basis of the finite element space.
% u Vector representation of discrete function with respect
% to the given basis and grid.
%
dim = size(grid.nodes,1); dim = size(grid.nodes,1);
if (dim==2) if (dim==2)
% referenceElement = generateGrid([0 0; 1 0; 0 1]', [1 2 3]'); n_nodes = size(grid.nodes, 2);
trisurf(grid.elements(1:3,:)', grid.nodes(1,:)', grid.nodes(2,:)', u(1:n_nodes), u(1:n_nodes));
else
error( 'Plotting in dim=%d is not supported.', ...
dim );
end
n_nodes = size(grid.nodes, 2);
trisurf(grid.elements(1:3,:)', grid.nodes(1,:)', grid.nodes(2,:)', u(1:n_nodes), u(1:n_nodes));
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment