TESTMEASUREMENTS Creates a test case for measurement time series CALL: D = testmeasurements(pos,type,thet0,f0,N,dt,amp,h,g,thetx,thety); D = matrix containing column vectors of time series, size N x M+1 pos = coordinate position of the sensors in each row, size M x 3. type = vector of sensortypes given as integers see tran for options, length M thet0 = primary direction in degrees toward which the waves travels (0 = East, 90 = North,...etc) (default 0) f0 = primary frequency in Hz (default 0.1 Hz) N = number of time steps (default 5000) dt = time increment (default 0.5) amp = amplitude (default 1) 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: type = [1 1 1]; bfs = ones(1,3);h=inf; th0 = 90; pos = [0 0 0;0 40 0; 20 20 0]; D = testmeasurements(pos,type,th0); S = dat2dspec(D,[pos type' bfs'],h); wspecplot(S) See also testbuoy, dat2dspec, tran
returns the constant acceleration of gravity | |
Computes transfer functions based on linear wave theory | |
Translates from frequency to wave number | |
Display message and abort function. |
001 function D = testsurf(pos,type,thet0,f0,N,dt,amp,d,g,thetx,thety); 002 %TESTMEASUREMENTS Creates a test case for measurement time series 003 % 004 % CALL: D = testmeasurements(pos,type,thet0,f0,N,dt,amp,h,g,thetx,thety); 005 % 006 % D = matrix containing column vectors of time series, size N x M+1 007 % pos = coordinate position of the sensors in each row, size M x 3. 008 % type = vector of sensortypes given as integers see tran for options, length M 009 % thet0 = primary direction in degrees toward which the waves travels 010 % (0 = East, 90 = North,...etc) (default 0) 011 % f0 = primary frequency in Hz (default 0.1 Hz) 012 % N = number of time steps (default 5000) 013 % dt = time increment (default 0.5) 014 % amp = amplitude (default 1) 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 % type = [1 1 1]; bfs = ones(1,3);h=inf; 028 % th0 = 90; 029 % pos = [0 0 0;0 40 0; 20 20 0]; 030 % D = testmeasurements(pos,type,th0); 031 % S = dat2dspec(D,[pos type' bfs'],h); 032 % wspecplot(S) 033 % 034 % See also testbuoy, dat2dspec, tran 035 036 % History: 037 % by pab 14.10.2002 038 039 040 error(nargchk(2,11,nargin)) 041 042 [M ,p] = size(pos); 043 if M~=length(type) 044 error('size(pos,1) must be equal to length(type)') 045 end 046 047 if nargin<3|isempty(thet0), thet0 = 0;end 048 if nargin<4|isempty(f0), f0 = 0.1;end 049 if nargin<5|isempty(N), N = 5000;end 050 if nargin<6|isempty(dt), dt = 0.5;end 051 if nargin<7|isempty(amp), amp = 1;end 052 if nargin<8|isempty(d), d = inf;end 053 if nargin<9|isempty(g), g = gravity;end 054 if nargin<10|isempty(thetx), thetx = 90;end 055 if nargin<11|isempty(thety), thety = 0;end 056 057 058 %convert from degrees to radians 059 thet0r=thet0*pi/180; 060 061 062 063 064 % Compute wave number 065 % ------------------- 066 w0 = 2*pi*f0; 067 kw = w2k(w0,0,d,g); 068 069 t=[0:N-1]'*dt; 070 eta0 = amp*exp(-i*w0*t); 071 072 D = zeros(N,M); 073 074 for ix=1:M 075 [Hw, Gwt] = tran(w0,thet0r,pos(ix,:),type(ix),d,g,[],[],[],thetx,thety,kw); 076 D(:,ix) = real(Hw*Gwt*eta0)+0.0001*sqrt(amp^2)*rand(N,1); 077 end 078 079 D = [t D]; 080 081 082
Comments or corrections to the WAFO group