Home > wafo > multidim > testsurf.m

testsurf

PURPOSE ^

creates a test case for a surface elevation measurement

SYNOPSIS ^

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

DESCRIPTION ^

 TESTSURF creates a test case for a surface elevation measurement
  
  CALL  D = testsurf(N,dt,amp,f0,thet0,x,y,h,g,thetx,thety);
 
    D     = matrix containing column vectors of time series
    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,...etc)
    x     = vector of x-coordinates length M
    y     = vector of y-coordinates length M
    h     = water depth               (default infinity)
    g     = acceleration 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 A TEST CASE:
   eta = amp*cos(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 40 0 1 1; 20 20 0 1 1];
    D = testsurf(N,dt,3,f0,th0,xypos(:,1),xypos(:,2),h);
    S = dat2dspec(D,xypos,h);
 
  See also  testbuoy, dat2dspec

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

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