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

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

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

Adding diwasp customizations.

Line 
1 function S=smoothspec(Sin,kernel)
2 % smooths a directional spectrum using the
3 % first dimension is frequency
4 % kernel is 2*3 matrix with smoothing parameters
5
6 f1=kernel(1,3);
7 f2=kernel(1,2);
8 f3=kernel(1,1);
9 d1=kernel(2,3);
10 d2=kernel(2,2);
11 d3=kernel(2,1);
12 tot=2*f1+2*f2+f3+2*d1+2*d2+d3;
13
14 nf=size(Sin,1);
15 nd=size(Sin,2);
16
17 S=Sin;
18
19 S(3:nf-2,3:nd-2)=(f1*Sin(1:nf-4,3:nd-2)+f2*Sin(2:nf-3,3:nd-2)+f3*Sin(3:nf-2,3:nd-2)+f2*Sin(4:nf-1,3:nd-2)+f1*Sin(5:nf,3:nd-2)+...
20    d1*Sin(3:nf-2,1:nd-4)+d2*Sin(3:nf-2,2:nd-3)+d3*Sin(3:nf-2,3:nd-2)+d2*Sin(3:nf-2,4:nd-1)+d1*Sin(3:nf-2,5:nd))./tot;
21
22
Note: See TracBrowser for help on using the browser.