Revision 495
(checked in by cbc, 12 years ago)
|
Initial import of Stark code.
|
Line | |
---|
1 |
% |
---|
2 |
% GRAD - Compute the gradient of a FEM 2-D scalar field |
---|
3 |
% |
---|
4 |
% GRAD(e,x,y,s) computes the divergence of a 2-D |
---|
5 |
% scalar field (s) over the FEM domain specified by the |
---|
6 |
% element list (e) and the corresponding horizontal node |
---|
7 |
% coordinates (x,y). The result is a 2-D vector field |
---|
8 |
% returned to the workspace. |
---|
9 |
% |
---|
10 |
% Call as: gd=grad(e,x,y,s); |
---|
11 |
% |
---|
12 |
% All arguments are REQUIRED. |
---|
13 |
% |
---|
14 |
% Written by: |
---|
15 |
% Brian O. Blanton |
---|
16 |
% Curr. in Marine Science |
---|
17 |
% 15-1A Venable Hall |
---|
18 |
% CB# 3300 |
---|
19 |
% Uni. of North Carolina |
---|
20 |
% Chapel Hill, NC |
---|
21 |
% 27599-3300 |
---|
22 |
% |
---|
23 |
% 919-962-4466 |
---|
24 |
% blanton@marine.unc.edu |
---|
25 |
function gr=grad(e,x,y,q) |
---|
26 |
|
---|
27 |
if nargout~=1 |
---|
28 |
error('GRAD must have 1 (and only 1) output argument.') |
---|
29 |
else |
---|
30 |
[grdu grdv]=gradmex5(x,y,e,q); |
---|
31 |
gr=[grdu(:) grdv(:)]; |
---|
32 |
end |
---|