NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/FCAST_1.2/matlab_cen/basis1d1.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 %***********************************************************************
2 %***********************************************************************
3 % function [b2,n2,b1,n1]=basis1d1(zref,zdes)
4 %-----------------------------------------------------------------------
5 % purpose: This subroutine evaluates the value of the basis functions
6 %            alive on a 1-D linear element at a point
7 %
8 % restrictions: Applicable only for  1-D linear elements
9 %
10 % inputs:  nn is the number of entries in the reference z array
11 %          zref(nn) is the 1-D array containing the reference z array
12 %               NOTE: zref must increase from zref(1) to zref(nn)
13 %          zdes is the z value at which the basis functions are desired
14 %
15 % outputs: n1 is the reference node immediately below zdes
16 %          b1 is the value of the n1's basis function at zdes
17 %          n2 is the reference node immediately above zdes
18 %          b2 is the value of the n2's basis function at zdes
19 %
20 % notes:   zdes<zref(1)  => n1=nn,b1=0.0,n2=1,b2=1.0
21 %          zdes>zref(nn) => n1=nn,b1=1.0,n2=1,b2=0.0
22 %
23 % history:  Written by Christopher E. Naimie
24 %           Dartmouth College
25 %           26 AUGUST 1992
26 %-----------------------------------------------------------------------
27 function [b2,n2,b1,n1]=basis1d1(zref,zdes)
28 %
29 zdiff=zref-zdes;nn=length(zref);
30 if zdiff(1) >= 0;
31    n1=nn;b1=0.0;n2=1;b2=1.0;
32 elseif zdiff(length(zdiff)) <= 0;
33    n1=nn;b1=1.0;n2=1;b2=0.0;
34 else
35    zpast=find(zdiff<=0);
36    n1=zpast(length(zpast));
37    n2=n1+1;
38    dz=zref(n2)-zref(n1);
39    b1=(zref(n2)-zdes)/dz;
40    b2=(zdes-zref(n1))/dz;
41 end   
42 %***********************************************************************
43 %***********************************************************************
Note: See TracBrowser for help on using the browser.