Home > wafo > multidim > testbuoy.m

testbuoy

PURPOSE ^

creates a test case for a buoy measurement

SYNOPSIS ^

D=testbuoy(N,dt,amp,f0,thet0,x,y,d,g,thetx,thety);

DESCRIPTION ^

 TESTBUOY creates a test case for a buoy measurement
  
  CALL  D = testbuoy(N,dt,amp,f0,thet0,x,y,h,g,thetx,thety);
 
    D     = matrix of time series 
            for M=1:
            c1: time c2: eta c3: x-slope c4: y-slope
    N     = number of time steps
    dt    = time increment
    amp   = amplitude
    f0    = primary frequency in Hz
    thet0 = primary direction in degrees toward which the waves travels
            (0 = North, 90 = East)
    x     = vector of x-coordinates length M
    y     = vector of y-coordinates length M
    h     = water depth               (default infinity)
    g     = accelleration of gravity  (default see gravity)
    thetx = angle in degrees clockwise from north to the + x-axis
                    (default 90)
    thety = angle in degrees clockwise from north to the + y-axis
                    (default 0)
 
  CREATE BUOY TEST CASE:
   eta = amp*cos(k*x*cos(th0)+k*y*sin(th0)-2*pi*f0*t);
   x-slope = -amp*k*cos(th0)*sin(k*x*cos(th0)+k*y*sin(th0)-2*pi*f0*t);
   y-slope = -amp*k*sin(th0)*sin(k*x*cos(th0)+k*y*sin(th0)-2*pi*f0*t);
      with cos(th0) = cos(thet0-thetx);
           sin(th0) = cos(thet0-thety);
 
  Example:
    N=5000;dt=0.4;f0=0.1;th0=0;h=50;xypos=[0 0 0 1 1;0 0 0 4 0; 0 0 0 5 0];
    D = testbuoy(N,dt,3,f0,th0,0,0,h);
    S = dat2dspec(D,xypos,h);
 
  See also  testsurf, dat2dspec

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function D=testbuoy(N,dt,amp,f0,thet0,x,y,d,g,thetx,thety);
002 %TESTBUOY creates a test case for a buoy measurement
003 % 
004 % CALL  D = testbuoy(N,dt,amp,f0,thet0,x,y,h,g,thetx,thety);
005 %
006 %   D     = matrix of time series 
007 %           for M=1:
008 %           c1: time c2: eta c3: x-slope c4: y-slope
009 %   N     = number of time steps
010 %   dt    = time increment
011 %   amp   = amplitude
012 %   f0    = primary frequency in Hz
013 %   thet0 = primary direction in degrees toward which the waves travels
014 %           (0 = North, 90 = East)
015 %   x     = vector of x-coordinates length M
016 %   y     = vector of y-coordinates length M
017 %   h     = water depth               (default infinity)
018 %   g     = accelleration of gravity  (default see gravity)
019 %   thetx = angle in degrees clockwise from north to the + x-axis
020 %                   (default 90)
021 %   thety = angle in degrees clockwise from north to the + y-axis
022 %                   (default 0)
023 %
024 % CREATE BUOY TEST CASE:
025 %  eta = amp*cos(k*x*cos(th0)+k*y*sin(th0)-2*pi*f0*t);
026 %  x-slope = -amp*k*cos(th0)*sin(k*x*cos(th0)+k*y*sin(th0)-2*pi*f0*t);
027 %  y-slope = -amp*k*sin(th0)*sin(k*x*cos(th0)+k*y*sin(th0)-2*pi*f0*t);
028 %     with cos(th0) = cos(thet0-thetx);
029 %          sin(th0) = cos(thet0-thety);
030 %
031 % Example:
032 %   N=5000;dt=0.4;f0=0.1;th0=0;h=50;xypos=[0 0 0 1 1;0 0 0 4 0; 0 0 0 5 0];
033 %   D = testbuoy(N,dt,3,f0,th0,0,0,h);
034 %   S = dat2dspec(D,xypos,h);
035 %
036 % See also  testsurf, dat2dspec
037 
038 % History:
039 % revised pab 14.06.2000
040 % updated documentation
041 % revised pab 06.01.2000
042 %  - updated documentation
043 %  - added default values
044 %  - corrected the D matrix + added sampling times
045 % by  L. Borgman
046 
047 if nargin<8|isempty(d),      d     = inf;    end
048 if nargin<9|isempty(g),      g     = gravity;end
049 if nargin<10|isempty(thetx), thetx = 90;     end
050 if nargin<11|isempty(thety), thety = 0;      end
051 
052 thet0r=thet0*pi/180;
053 thetxr=thetx*pi/180;
054 thetyr=thety*pi/180;
055 
056 X=ones(N,1)*x(:)';
057 Y=ones(N,1)*y(:)';
058 t=[0:N-1]'*dt;
059 T=t*ones(1,size(x,1));
060 
061 % Compute wave number
062 % -------------------
063 k=w2k(2*pi*f0,0,d,g);
064 
065 % Compute test time series
066 % ------------------------
067 mx=k*cos(thet0r-thetxr);
068 my=k*cos(thet0r-thetyr);
069 D=amp*cos(k*X*cos(thet0r-thetxr)+k*Y*cos(thet0r-thetyr)-2*pi*f0*T);
070 D=[D, -mx*amp*sin(k*X*cos(thet0r-thetxr)+k*Y*cos(thet0r-thetyr)-2*pi*f0*T)];
071 D=[D, -my*amp*sin(k*X*cos(thet0r-thetxr)+k*Y*cos(thet0r-thetyr)-2*pi*f0*T)];
072 
073 % Add in some noise
074 % -----------------
075 D=D+.01*sqrt(((amp^2)/2)/100)*randn(size(D));
076 D=[T,D];
077

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group


Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003