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

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

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

Adding diwasp customizations.

Line 
1 function eta=makewavedata(eamp,ffreqs,wns,dirs,layout,datatypes,depth,fs,ndat)
2
3 %makewavedata: make pseudo random sea elevation data for a specified layout of probes
4 %
5 %[eta] = makewavedata(eamp,ffreqs,wns,dirs,layout,datatypes,depth,fs,ndat)
6 %
7 %outputs:
8 %eta            is output surface elevation
9 %
10 %inputs
11 %eamp           matrix of the component amplitudes [i,j] with i'th frequency component and j'th directional component
12 %ffreqs     column vector of component radian frequencies. These must correspond to the frequency bins in input eamp
13 %wns            column vector of component wavenumbers in m-1. These must correspond to the frequency bins in input eamp
14 %dirs           row vector of component directions in rads. These must correspond to the directional bins in input eamp
15 %layout     matrix containing x,y,z coordinates of instrument location with format:
16 %                               [x1 x2 x3...]
17 %                               [y1 y2 y3...]
18 %                               [z1 z2 z3...])
19 %datatypes  data type matrix containing sensor types for DIWASP transfer functions: must have same number of columns as layout
20 %depth      mean water depth
21 %fs                 sampling frequency
22 %ndat           length of data
23 %
24 %amplitude matrix must be [m by n] where m is number of wavenumber
25 %components in wns and n is number of directional components in dirs
26 %
27
28 %Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth
29
30
31 disp('generating instrument data');
32
33 randphase=2*pi*rand(size(eamp));
34 nprobes=size(layout,2);
35 dt=1/fs;
36 t=[0:dt:dt*ndat];
37
38 freqmat=ffreqs*ones(size(dirs));
39
40 %get transfer functions for instrument type -------- NOTE: added layout 1
41 %and 2 to account for newly added xpos and ypos needed to use radial.m
42 for i=1:nprobes
43     trf(:,:,i)=feval(datatypes{i},ffreqs,dirs,wns,layout(3,i),depth,layout(1,i),layout(2,i));
44 end
45
46 %make random data
47 for i=1:ndat
48    for j=1:nprobes
49       eta(i,j)=sum(sum(eamp.*trf(:,:,j).*cos(layout(1,j)*wns*cos(dirs)+layout(2,j)*wns*sin(dirs)-freqmat*t(i)+randphase)));
50    end
51 end
52
53
Note: See TracBrowser for help on using the browser.