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

root/adcp/trunk/adcp/diwasp_1_1GD/private/wavenumber.m

Revision 168 (checked in by cbc, 16 years ago)

Adding diwasp customizations.

Line 
1 function [k]= wavenumber(sigma,h)
2 %k = wavenumber(sigma,h)
3 %
4 %k is the matrix of same size as sigma and h containing the calculated wave numbers
5 %
6 %sigma is the wave frequencies in rad/s
7 %h is the water depth
8 %
9 %sigma and h must be scalars,vectors or matricies of the same dimensions
10 %
11
12 %modified from R.Dalrymple's java code
13 %
14
15 g=9.81;
16
17         a0=(sigma.*sigma.*h)./g;
18    b1=1.0./(tanh(a0.^0.75));
19    a1=a0.*(b1.^0.666);
20    da1=1000.0;
21    
22 d1=ones(size(h));
23  while(max(d1)==1) 
24  d1 = (abs(da1./a1) > .00000001);
25         th=tanh(a1);
26         ch=cosh(a1);
27         f1=a0-(a1.*th);
28         f2= - a1.*((1.0./ch).^2) -th;
29         da1= -f1./f2;
30         a1=a1+da1;
31  end
32
33 k=a1./h;
34    
35  
Note: See TracBrowser for help on using the browser.