|
|
@ -1,40 +1,39 @@
|
|
|
|
%% CHAPTER3 Demonstrates distributions of wave characteristics
|
|
|
|
import numpy as np
|
|
|
|
%
|
|
|
|
from scipy import *
|
|
|
|
% Chapter3 contains the commands used in Chapter3 in the tutorial.
|
|
|
|
from pylab import *
|
|
|
|
%
|
|
|
|
|
|
|
|
% Some of the commands are edited for fast computation.
|
|
|
|
#! CHAPTER3 Demonstrates distributions of wave characteristics
|
|
|
|
% Each set of commands is followed by a 'pause' command.
|
|
|
|
#!=============================================================
|
|
|
|
%
|
|
|
|
#!
|
|
|
|
|
|
|
|
#! Chapter3 contains the commands used in Chapter3 in the tutorial.
|
|
|
|
% Tested on Matlab 5.3
|
|
|
|
#!
|
|
|
|
% History
|
|
|
|
#! Some of the commands are edited for fast computation.
|
|
|
|
% Revised pab sept2005
|
|
|
|
#!
|
|
|
|
% Added sections -> easier to evaluate using cellmode evaluation.
|
|
|
|
#! Section 3.2 Estimation of wave characteristics from data
|
|
|
|
% Revised by pab Feb 2005
|
|
|
|
#!----------------------------------------------------------
|
|
|
|
% -updated calls to kdetools+spec2XXpdf programs
|
|
|
|
#! Example 1
|
|
|
|
% Created by GL July 12, 2000
|
|
|
|
#!~~~~~~~~~~
|
|
|
|
% from commands used in Chapter 3, written by IR
|
|
|
|
|
|
|
|
%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%% Section 3.2 Estimation of wave characteristics from data
|
|
|
|
|
|
|
|
%% Example 1
|
|
|
|
|
|
|
|
pstate = 'off';
|
|
|
|
|
|
|
|
speed = 'fast'
|
|
|
|
speed = 'fast'
|
|
|
|
%speed = 'slow'
|
|
|
|
#speed = 'slow'
|
|
|
|
|
|
|
|
|
|
|
|
xx = load('sea.dat');
|
|
|
|
import wafo.data as wd
|
|
|
|
xx(:,2) = detrend(xx(:,2));
|
|
|
|
import wafo.misc as wm
|
|
|
|
rate = 8;
|
|
|
|
import wafo.objects as wo
|
|
|
|
Tcrcr = dat2wa(xx,0,'c2c','tw',rate);
|
|
|
|
xx = wd.sea()
|
|
|
|
Tc = dat2wa(xx,0,'u2d','tw',rate);
|
|
|
|
xx[:,1] = wm.detrend(xx[:,1])
|
|
|
|
disp('Block = 1'), pause(pstate)
|
|
|
|
ts = wo.mat2timeseries(xx)
|
|
|
|
|
|
|
|
Tcrcr, ix = ts.wave_periods(vh=0, pdef='c2c', wdef='tw', rate=8)
|
|
|
|
%% Histogram of crestperiod compared to the kernel density estimate
|
|
|
|
Tc, ixc = ts.wave_periods(vh=0, pdef='u2d', wdef='tw', rate=8)
|
|
|
|
clf
|
|
|
|
|
|
|
|
mean(Tc)
|
|
|
|
#! Histogram of crestperiod compared to the kernel density estimate
|
|
|
|
max(Tc)
|
|
|
|
#!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
import wafo.kdetools as wk
|
|
|
|
|
|
|
|
clf()
|
|
|
|
|
|
|
|
print(Tc.mean())
|
|
|
|
|
|
|
|
print(Tc.max())
|
|
|
|
t = linspace(0.01,8,200);
|
|
|
|
t = linspace(0.01,8,200);
|
|
|
|
|
|
|
|
|
|
|
|
kopt = kdeoptset('L2',0);
|
|
|
|
kopt = kdeoptset('L2',0);
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
ftc1 = kde(Tc,kopt,t);
|
|
|
|
ftc1 = kde(Tc,kopt,t);
|
|
|
@ -44,7 +43,7 @@ histgrm(Tc,[],[],1)
|
|
|
|
axis([0 8 0 0.5])
|
|
|
|
axis([0 8 0 0.5])
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
disp('Block = 2'), pause(pstate)
|
|
|
|
disp('Block = 2'), pause(pstate)
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
kopt.inc = 128;
|
|
|
|
kopt.inc = 128;
|
|
|
|
ftc2 = kdebin(Tc,kopt);
|
|
|
|
ftc2 = kdebin(Tc,kopt);
|
|
|
@ -54,7 +53,7 @@ title('Kernel Density Estimates')
|
|
|
|
hold off
|
|
|
|
hold off
|
|
|
|
disp('Block = 3'), pause(pstate)
|
|
|
|
disp('Block = 3'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Extreme waves - model check: the highest and steepest wave
|
|
|
|
#!#! Extreme waves - model check: the highest and steepest wave
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
method = 0;
|
|
|
|
method = 0;
|
|
|
|
rate = 8;
|
|
|
|
rate = 8;
|
|
|
@ -69,9 +68,9 @@ spwaveplot(yn,[indA indS],'k.')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
disp('Block = 5'), pause(pstate)
|
|
|
|
disp('Block = 5'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Does the highest wave contradict a transformed Gaussian model?
|
|
|
|
#!#! Does the highest wave contradict a transformed Gaussian model?
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
inds1 = (5965:5974)'; % points to remove
|
|
|
|
inds1 = (5965:5974)'; #! points to remove
|
|
|
|
Nsim = 10;
|
|
|
|
Nsim = 10;
|
|
|
|
[y1, grec1, g2, test, tobs, mu1o, mu1oStd] = ...
|
|
|
|
[y1, grec1, g2, test, tobs, mu1o, mu1oStd] = ...
|
|
|
|
reconstruct(xx,inds1,Nsim);
|
|
|
|
reconstruct(xx,inds1,Nsim);
|
|
|
@ -87,28 +86,28 @@ wafostamp([],'(ER)')
|
|
|
|
disp('Block = 6'),
|
|
|
|
disp('Block = 6'),
|
|
|
|
pause(pstate)
|
|
|
|
pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Expected value (solid) compared to data removed
|
|
|
|
#!#! Expected value (solid) compared to data removed
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
plot(xx(inds1,1),xx(inds1,2),'+'), hold on
|
|
|
|
plot(xx(inds1,1),xx(inds1,2),'+'), hold on
|
|
|
|
mu = tranproc(mu1o,fliplr(grec1));
|
|
|
|
mu = tranproc(mu1o,fliplr(grec1));
|
|
|
|
plot(y1(inds1,1), mu), hold off
|
|
|
|
plot(y1(inds1,1), mu), hold off
|
|
|
|
disp('Block = 7'), pause(pstate)
|
|
|
|
disp('Block = 7'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Crest height PDF
|
|
|
|
#!#! Crest height PDF
|
|
|
|
% Transform data so that kde works better
|
|
|
|
#! Transform data so that kde works better
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
L2 = 0.6;
|
|
|
|
L2 = 0.6;
|
|
|
|
plotnorm(Ac.^L2)
|
|
|
|
plotnorm(Ac.^L2)
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
%
|
|
|
|
#!
|
|
|
|
fac = kde(Ac,{'L2',L2},linspace(0.01,3,200));
|
|
|
|
fac = kde(Ac,{'L2',L2},linspace(0.01,3,200));
|
|
|
|
pdfplot(fac)
|
|
|
|
pdfplot(fac)
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
simpson(fac.x{1},fac.f)
|
|
|
|
simpson(fac.x{1},fac.f)
|
|
|
|
disp('Block = 8'), pause(pstate)
|
|
|
|
disp('Block = 8'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Empirical crest height CDF
|
|
|
|
#!#! Empirical crest height CDF
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
Fac = flipud(cumtrapz(fac.x{1},flipud(fac.f)));
|
|
|
|
Fac = flipud(cumtrapz(fac.x{1},flipud(fac.f)));
|
|
|
|
Fac = [fac.x{1} 1-Fac];
|
|
|
|
Fac = [fac.x{1} 1-Fac];
|
|
|
@ -117,7 +116,7 @@ axis([0 2 0 1])
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
disp('Block = 9'), pause(pstate)
|
|
|
|
disp('Block = 9'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Empirical crest height CDF compared to a Transformed Rayleigh approximation
|
|
|
|
#!#! Empirical crest height CDF compared to a Transformed Rayleigh approximation
|
|
|
|
facr = trraylpdf(fac.x{1},'Ac',grec1);
|
|
|
|
facr = trraylpdf(fac.x{1},'Ac',grec1);
|
|
|
|
Facr = cumtrapz(facr.x{1},facr.f);
|
|
|
|
Facr = cumtrapz(facr.x{1},facr.f);
|
|
|
|
hold on
|
|
|
|
hold on
|
|
|
@ -126,7 +125,7 @@ axis([1.25 2.25 0.95 1])
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
disp('Block = 10'), pause(pstate)
|
|
|
|
disp('Block = 10'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Joint pdf of crest period and crest amplitude
|
|
|
|
#!#! Joint pdf of crest period and crest amplitude
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
kopt2 = kdeoptset('L2',0.5,'inc',256);
|
|
|
|
kopt2 = kdeoptset('L2',0.5,'inc',256);
|
|
|
|
Tc = Tcf+Tcb;
|
|
|
|
Tc = Tcf+Tcb;
|
|
|
@ -139,7 +138,7 @@ hold off
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
disp('Block = 11'), pause(pstate)
|
|
|
|
disp('Block = 11'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Example 4: Simple wave characteristics obtained from Jonswap spectrum
|
|
|
|
#!#! Example 4: Simple wave characteristics obtained from Jonswap spectrum
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
S = jonswap([],[5 10]);
|
|
|
|
S = jonswap([],[5 10]);
|
|
|
|
[m, mt]= spec2mom(S,4,[],0);
|
|
|
|
[m, mt]= spec2mom(S,4,[],0);
|
|
|
@ -150,15 +149,15 @@ spec2bw(S)
|
|
|
|
[ch Sa2] = spec2char(S,[1 3])
|
|
|
|
[ch Sa2] = spec2char(S,[1 3])
|
|
|
|
disp('Block = 13'), pause(pstate)
|
|
|
|
disp('Block = 13'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Section 3.3.2 Explicit form approximations of wave characteristic densities
|
|
|
|
#!#! Section 3.3.2 Explicit form approximations of wave characteristic densities
|
|
|
|
%% Longuett-Higgins model for Tc and Ac
|
|
|
|
#!#! Longuett-Higgins model for Tc and Ac
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
t = linspace(0,15,100);
|
|
|
|
t = linspace(0,15,100);
|
|
|
|
h = linspace(0,6,100);
|
|
|
|
h = linspace(0,6,100);
|
|
|
|
flh = lh83pdf(t,h,[m(1),m(2),m(3)]);
|
|
|
|
flh = lh83pdf(t,h,[m(1),m(2),m(3)]);
|
|
|
|
disp('Block = 14'), pause(pstate)
|
|
|
|
disp('Block = 14'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Transformed Longuett-Higgins model for Tc and Ac
|
|
|
|
#!#! Transformed Longuett-Higgins model for Tc and Ac
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
[sk, ku ]=spec2skew(S);
|
|
|
|
[sk, ku ]=spec2skew(S);
|
|
|
|
sa = sqrt(m(1));
|
|
|
|
sa = sqrt(m(1));
|
|
|
@ -166,14 +165,14 @@ gh = hermitetr([],[sa sk ku 0]);
|
|
|
|
flhg = lh83pdf(t,h,[m(1),m(2),m(3)],gh);
|
|
|
|
flhg = lh83pdf(t,h,[m(1),m(2),m(3)],gh);
|
|
|
|
disp('Block = 15'), pause(pstate)
|
|
|
|
disp('Block = 15'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Cavanie model for Tc and Ac
|
|
|
|
#!#! Cavanie model for Tc and Ac
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
t = linspace(0,10,100);
|
|
|
|
t = linspace(0,10,100);
|
|
|
|
h = linspace(0,7,100);
|
|
|
|
h = linspace(0,7,100);
|
|
|
|
fcav = cav76pdf(t,h,[m(1) m(2) m(3) m(5)],[]);
|
|
|
|
fcav = cav76pdf(t,h,[m(1) m(2) m(3) m(5)],[]);
|
|
|
|
disp('Block = 16'), pause(pstate)
|
|
|
|
disp('Block = 16'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Example 5 Transformed Rayleigh approximation of crest- vs trough- amplitude
|
|
|
|
#!#! Example 5 Transformed Rayleigh approximation of crest- vs trough- amplitude
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
xx = load('sea.dat');
|
|
|
|
xx = load('sea.dat');
|
|
|
|
x = xx;
|
|
|
|
x = xx;
|
|
|
@ -194,7 +193,7 @@ hold off
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
disp('Block = 17'), pause(pstate)
|
|
|
|
disp('Block = 17'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
TC = dat2tc(xx, me);
|
|
|
|
TC = dat2tc(xx, me);
|
|
|
|
tc = tp2mm(TC);
|
|
|
|
tc = tp2mm(TC);
|
|
|
@ -203,7 +202,7 @@ At = -tc(:,1);
|
|
|
|
AcAt = Ac+At;
|
|
|
|
AcAt = Ac+At;
|
|
|
|
disp('Block = 18'), pause(pstate)
|
|
|
|
disp('Block = 18'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
Fac_h = [fac_h.x{1} cumtrapz(fac_h.x{1},fac_h.f)];
|
|
|
|
Fac_h = [fac_h.x{1} cumtrapz(fac_h.x{1},fac_h.f)];
|
|
|
|
subplot(3,1,1)
|
|
|
|
subplot(3,1,1)
|
|
|
@ -232,8 +231,8 @@ title('At+Ac CDF')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
disp('Block = 19'), pause(pstate)
|
|
|
|
disp('Block = 19'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Section 3.4 Exact wave distributions in transformed Gaussian Sea
|
|
|
|
#!#! Section 3.4 Exact wave distributions in transformed Gaussian Sea
|
|
|
|
%% Section 3.4.1 Density of crest period, crest length or encountered crest period
|
|
|
|
#!#! Section 3.4.1 Density of crest period, crest length or encountered crest period
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
S1 = torsethaugen([],[6 8],1);
|
|
|
|
S1 = torsethaugen([],[6 8],1);
|
|
|
|
D1 = spreading(101,'cos',pi/2,[15],[],0);
|
|
|
|
D1 = spreading(101,'cos',pi/2,[15],[],0);
|
|
|
@ -242,7 +241,7 @@ SD1 = mkdspec(S1,D1);
|
|
|
|
SD12 = mkdspec(S1,D12);
|
|
|
|
SD12 = mkdspec(S1,D12);
|
|
|
|
disp('Block = 20'), pause(pstate)
|
|
|
|
disp('Block = 20'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Crest period
|
|
|
|
#!#! Crest period
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
f_tc = spec2tpdf(S1,[],'Tc',[0 11 56],[],4);
|
|
|
|
f_tc = spec2tpdf(S1,[],'Tc',[0 11 56],[],4);
|
|
|
@ -252,13 +251,13 @@ wafostamp([],'(ER)')
|
|
|
|
simpson(f_tc.x{1},f_tc.f)
|
|
|
|
simpson(f_tc.x{1},f_tc.f)
|
|
|
|
disp('Block = 21'), pause(pstate)
|
|
|
|
disp('Block = 21'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Crest length
|
|
|
|
#!#! Crest length
|
|
|
|
|
|
|
|
|
|
|
|
if strncmpi(speed,'slow',1)
|
|
|
|
if strncmpi(speed,'slow',1)
|
|
|
|
opt1 = rindoptset('speed',5,'method',3);
|
|
|
|
opt1 = rindoptset('speed',5,'method',3);
|
|
|
|
opt2 = rindoptset('speed',5,'nit',2,'method',0);
|
|
|
|
opt2 = rindoptset('speed',5,'nit',2,'method',0);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
% fast
|
|
|
|
#! fast
|
|
|
|
opt1 = rindoptset('speed',7,'method',3);
|
|
|
|
opt1 = rindoptset('speed',7,'method',3);
|
|
|
|
opt2 = rindoptset('speed',7,'nit',2,'method',0);
|
|
|
|
opt2 = rindoptset('speed',7,'nit',2,'method',0);
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -271,7 +270,7 @@ else
|
|
|
|
disp('NIT=5 may take time, running with NIT=3 in the following')
|
|
|
|
disp('NIT=5 may take time, running with NIT=3 in the following')
|
|
|
|
NITa = 3;
|
|
|
|
NITa = 3;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
%f_Lc = spec2tpdf2(S1,[],'Lc',[0 200 81],opt1); % Faster and more accurate
|
|
|
|
#!f_Lc = spec2tpdf2(S1,[],'Lc',[0 200 81],opt1); #! Faster and more accurate
|
|
|
|
f_Lc = spec2tpdf(S1,[],'Lc',[0 200 81],[],NITa);
|
|
|
|
f_Lc = spec2tpdf(S1,[],'Lc',[0 200 81],[],NITa);
|
|
|
|
pdfplot(f_Lc,'-.')
|
|
|
|
pdfplot(f_Lc,'-.')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
@ -279,27 +278,27 @@ disp('Block = 22'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f_Lc_1 = spec2tpdf(S1,[],'Lc',[0 200 81],1.5,NITa);
|
|
|
|
f_Lc_1 = spec2tpdf(S1,[],'Lc',[0 200 81],1.5,NITa);
|
|
|
|
%f_Lc_1 = spec2tpdf2(S1,[],'Lc',[0 200 81],1.5,opt1);
|
|
|
|
#!f_Lc_1 = spec2tpdf2(S1,[],'Lc',[0 200 81],1.5,opt1);
|
|
|
|
|
|
|
|
|
|
|
|
hold on
|
|
|
|
hold on
|
|
|
|
pdfplot(f_Lc_1)
|
|
|
|
pdfplot(f_Lc_1)
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
|
|
|
|
|
|
|
|
disp('Block = 23'), pause(pstate)
|
|
|
|
disp('Block = 23'), pause(pstate)
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
simpson(f_Lc.x{1},f_Lc.f)
|
|
|
|
simpson(f_Lc.x{1},f_Lc.f)
|
|
|
|
simpson(f_Lc_1.x{1},f_Lc_1.f)
|
|
|
|
simpson(f_Lc_1.x{1},f_Lc_1.f)
|
|
|
|
|
|
|
|
|
|
|
|
disp('Block = 24'), pause(pstate)
|
|
|
|
disp('Block = 24'), pause(pstate)
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
|
|
|
|
|
|
|
|
f_Lc_d1 = spec2tpdf(rotspec(SD1,pi/2),[],'Lc',[0 300 121],[],NITa);
|
|
|
|
f_Lc_d1 = spec2tpdf(rotspec(SD1,pi/2),[],'Lc',[0 300 121],[],NITa);
|
|
|
|
f_Lc_d12 = spec2tpdf(SD12,[],'Lc',[0 200 81],[],NITa);
|
|
|
|
f_Lc_d12 = spec2tpdf(SD12,[],'Lc',[0 200 81],[],NITa);
|
|
|
|
% f_Lc_d1 = spec2tpdf2(rotspec(SD1,pi/2),[],'Lc',[0 300 121],opt1);
|
|
|
|
#! f_Lc_d1 = spec2tpdf2(rotspec(SD1,pi/2),[],'Lc',[0 300 121],opt1);
|
|
|
|
% f_Lc_d12 = spec2tpdf2(SD12,[],'Lc',[0 200 81],opt1);
|
|
|
|
#! f_Lc_d12 = spec2tpdf2(SD12,[],'Lc',[0 200 81],opt1);
|
|
|
|
toc
|
|
|
|
toc
|
|
|
|
pdfplot(f_Lc_d1,'-.'), hold on
|
|
|
|
pdfplot(f_Lc_d1,'-.'), hold on
|
|
|
|
pdfplot(f_Lc_d12), hold off
|
|
|
|
pdfplot(f_Lc_d12), hold off
|
|
|
@ -307,7 +306,7 @@ wafostamp([],'(ER)')
|
|
|
|
|
|
|
|
|
|
|
|
disp('Block = 25'), pause(pstate)
|
|
|
|
disp('Block = 25'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clf
|
|
|
|
clf
|
|
|
@ -317,26 +316,26 @@ if strncmpi(speed,'slow',1)
|
|
|
|
f_Lc_d1_5 = spec2tpdf(SD1r,[], 'Lc',[0 300 121],[],5);
|
|
|
|
f_Lc_d1_5 = spec2tpdf(SD1r,[], 'Lc',[0 300 121],[],5);
|
|
|
|
pdfplot(f_Lc_d1_5), hold on
|
|
|
|
pdfplot(f_Lc_d1_5), hold on
|
|
|
|
else
|
|
|
|
else
|
|
|
|
% fast
|
|
|
|
#! fast
|
|
|
|
disp('Run the following example only if you want a check on computing time')
|
|
|
|
disp('Run the following example only if you want a check on computing time')
|
|
|
|
disp('Edit the command file and remove %')
|
|
|
|
disp('Edit the command file and remove #!')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
f_Lc_d1_3 = spec2tpdf(SD1r,[],'Lc',[0 300 121],[],3);
|
|
|
|
f_Lc_d1_3 = spec2tpdf(SD1r,[],'Lc',[0 300 121],[],3);
|
|
|
|
f_Lc_d1_2 = spec2tpdf(SD1r,[],'Lc',[0 300 121],[],2);
|
|
|
|
f_Lc_d1_2 = spec2tpdf(SD1r,[],'Lc',[0 300 121],[],2);
|
|
|
|
f_Lc_d1_0 = spec2tpdf(SD1r,[],'Lc',[0 300 121],[],0);
|
|
|
|
f_Lc_d1_0 = spec2tpdf(SD1r,[],'Lc',[0 300 121],[],0);
|
|
|
|
%f_Lc_d1_n4 = spec2tpdf2(SD1r,[],'Lc',[0 400 161],opt1);
|
|
|
|
#!f_Lc_d1_n4 = spec2tpdf2(SD1r,[],'Lc',[0 400 161],opt1);
|
|
|
|
|
|
|
|
|
|
|
|
pdfplot(f_Lc_d1_3), hold on
|
|
|
|
pdfplot(f_Lc_d1_3), hold on
|
|
|
|
pdfplot(f_Lc_d1_2)
|
|
|
|
pdfplot(f_Lc_d1_2)
|
|
|
|
pdfplot(f_Lc_d1_0)
|
|
|
|
pdfplot(f_Lc_d1_0)
|
|
|
|
%pdfplot(f_Lc_d1_n4)
|
|
|
|
#!pdfplot(f_Lc_d1_n4)
|
|
|
|
|
|
|
|
|
|
|
|
%simpson(f_Lc_d1_n4.x{1},f_Lc_d1_n4.f)
|
|
|
|
#!simpson(f_Lc_d1_n4.x{1},f_Lc_d1_n4.f)
|
|
|
|
|
|
|
|
|
|
|
|
disp('Block = 26'), pause(pstate)
|
|
|
|
disp('Block = 26'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Section 3.4.2 Density of wave period, wave length or encountered wave period
|
|
|
|
#!#! Section 3.4.2 Density of wave period, wave length or encountered wave period
|
|
|
|
%% Example 7: Crest period and high crest waves
|
|
|
|
#!#! Example 7: Crest period and high crest waves
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
xx = load('sea.dat');
|
|
|
|
xx = load('sea.dat');
|
|
|
@ -354,7 +353,7 @@ t = linspace(0.01,8,200);
|
|
|
|
ftc1 = kde(Tc,{'L2',0},t);
|
|
|
|
ftc1 = kde(Tc,{'L2',0},t);
|
|
|
|
pdfplot(ftc1)
|
|
|
|
pdfplot(ftc1)
|
|
|
|
hold on
|
|
|
|
hold on
|
|
|
|
% f_t = spec2tpdf(SS,[],'Tc',[0 8 81],0,4);
|
|
|
|
#! f_t = spec2tpdf(SS,[],'Tc',[0 8 81],0,4);
|
|
|
|
f_t = spec2tpdf(SS,[],'Tc',[0 8 81],0,2);
|
|
|
|
f_t = spec2tpdf(SS,[],'Tc',[0 8 81],0,2);
|
|
|
|
simpson(f_t.x{1},f_t.f)
|
|
|
|
simpson(f_t.x{1},f_t.f)
|
|
|
|
pdfplot(f_t,'-.')
|
|
|
|
pdfplot(f_t,'-.')
|
|
|
@ -363,7 +362,7 @@ wafostamp([],'(ER)')
|
|
|
|
toc
|
|
|
|
toc
|
|
|
|
disp('Block = 27'), pause(pstate)
|
|
|
|
disp('Block = 27'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
|
|
|
|
|
|
|
@ -372,7 +371,7 @@ if strncmpi(speed,'slow',1)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
NIT = 2;
|
|
|
|
NIT = 2;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
% f_t2 = spec2tpdf(SS,[],'Tc',[0 8 81],[Hs/2],4);
|
|
|
|
#! f_t2 = spec2tpdf(SS,[],'Tc',[0 8 81],[Hs/2],4);
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
f_t2 = spec2tpdf(SS,[],'Tc',[0 8 81],Hs/2,NIT);
|
|
|
|
f_t2 = spec2tpdf(SS,[],'Tc',[0 8 81],Hs/2,NIT);
|
|
|
|
toc
|
|
|
|
toc
|
|
|
@ -390,14 +389,14 @@ wafostamp([],'(ER)')
|
|
|
|
toc
|
|
|
|
toc
|
|
|
|
disp('Block = 28'), pause(pstate)
|
|
|
|
disp('Block = 28'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Example 8: Wave period for high crest waves
|
|
|
|
#!#! Example 8: Wave period for high crest waves
|
|
|
|
% clf
|
|
|
|
#! clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
f_tcc2 = spec2tccpdf(SS,[],'t>',[0 12 61],[Hs/2],[0],-1);
|
|
|
|
f_tcc2 = spec2tccpdf(SS,[],'t>',[0 12 61],[Hs/2],[0],-1);
|
|
|
|
toc
|
|
|
|
toc
|
|
|
|
simpson(f_tcc2.x{1},f_tcc2.f)
|
|
|
|
simpson(f_tcc2.x{1},f_tcc2.f)
|
|
|
|
f_tcc3 = spec2tccpdf(SS,[],'t>',[0 12 61],[Hs/2],[0],3,5);
|
|
|
|
f_tcc3 = spec2tccpdf(SS,[],'t>',[0 12 61],[Hs/2],[0],3,5);
|
|
|
|
% f_tcc3 = spec2tccpdf(SS,[],'t>',[0 12 61],[Hs/2],[0],1,5);
|
|
|
|
#! f_tcc3 = spec2tccpdf(SS,[],'t>',[0 12 61],[Hs/2],[0],1,5);
|
|
|
|
simpson(f_tcc3.x{1},f_tcc3.f)
|
|
|
|
simpson(f_tcc3.x{1},f_tcc3.f)
|
|
|
|
pdfplot(f_tcc2,'-.')
|
|
|
|
pdfplot(f_tcc2,'-.')
|
|
|
|
hold on
|
|
|
|
hold on
|
|
|
@ -406,7 +405,7 @@ toc
|
|
|
|
toc
|
|
|
|
toc
|
|
|
|
disp('Block = 29'), pause(pstate)
|
|
|
|
disp('Block = 29'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
[TC tc_ind v_ind] = dat2tc(yn,[],'dw');
|
|
|
|
[TC tc_ind v_ind] = dat2tc(yn,[],'dw');
|
|
|
|
N = length(tc_ind);
|
|
|
|
N = length(tc_ind);
|
|
|
@ -418,7 +417,7 @@ spwaveplot(yn,ind(2:4))
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
disp('Block = 30'), pause(pstate)
|
|
|
|
disp('Block = 30'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
Tcc = yn(v_ind(1+2*ind),1)-yn(v_ind(1+2*(ind-1)),1);
|
|
|
|
Tcc = yn(v_ind(1+2*ind),1)-yn(v_ind(1+2*(ind-1)),1);
|
|
|
|
t = linspace(0.01,14,200);
|
|
|
|
t = linspace(0.01,14,200);
|
|
|
@ -441,10 +440,10 @@ disp('Block = 32'), pause(pstate)
|
|
|
|
disp('The rest of this chapter deals with joint densities.')
|
|
|
|
disp('The rest of this chapter deals with joint densities.')
|
|
|
|
disp('Some calculations may take some time.')
|
|
|
|
disp('Some calculations may take some time.')
|
|
|
|
disp('You could experiment with other NIT.')
|
|
|
|
disp('You could experiment with other NIT.')
|
|
|
|
%return
|
|
|
|
#!return
|
|
|
|
|
|
|
|
|
|
|
|
%% Section 3.4.3 Joint density of crest period and crest height
|
|
|
|
#!#! Section 3.4.3 Joint density of crest period and crest height
|
|
|
|
%% Example 9. Some preliminary analysis of the data
|
|
|
|
#!#! Example 9. Some preliminary analysis of the data
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
yy = load('gfaksr89.dat');
|
|
|
|
yy = load('gfaksr89.dat');
|
|
|
@ -457,7 +456,7 @@ v = v(2)
|
|
|
|
toc
|
|
|
|
toc
|
|
|
|
disp('Block = 33'), pause(pstate)
|
|
|
|
disp('Block = 33'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
[TC, tc_ind, v_ind] = dat2tc(yy,v,'dw');
|
|
|
|
[TC, tc_ind, v_ind] = dat2tc(yy,v,'dw');
|
|
|
@ -477,7 +476,7 @@ At = v-yy(t_ind,2);
|
|
|
|
toc
|
|
|
|
toc
|
|
|
|
disp('Block = 34'), pause(pstate)
|
|
|
|
disp('Block = 34'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
t = linspace(0.01,15,200);
|
|
|
|
t = linspace(0.01,15,200);
|
|
|
@ -497,8 +496,8 @@ wafostamp([],'(ER)')
|
|
|
|
toc
|
|
|
|
toc
|
|
|
|
disp('Block = 35'), pause(pstate)
|
|
|
|
disp('Block = 35'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Example 10: Joint characteristics of a half wave:
|
|
|
|
#!#! Example 10: Joint characteristics of a half wave:
|
|
|
|
%% position and height of a crest for a wave with given period
|
|
|
|
#!#! position and height of a crest for a wave with given period
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
ind = find(4.4<Tc & Tc<4.6);
|
|
|
|
ind = find(4.4<Tc & Tc<4.6);
|
|
|
@ -510,7 +509,7 @@ wafostamp([],'(ER)')
|
|
|
|
toc
|
|
|
|
toc
|
|
|
|
disp('Block = 36'), pause(pstate)
|
|
|
|
disp('Block = 36'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
opt1 = rindoptset('speed',5,'method',3);
|
|
|
|
opt1 = rindoptset('speed',5,'method',3);
|
|
|
@ -532,7 +531,7 @@ toc
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
disp('Block = 37'), pause(pstate)
|
|
|
|
disp('Block = 37'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
f_tcac_s = spec2thpdf(SS,[],'TcAc',[0 12 81],[Hs/2:0.1:2*Hs],opt1);
|
|
|
|
f_tcac_s = spec2thpdf(SS,[],'TcAc',[0 12 81],[Hs/2:0.1:2*Hs],opt1);
|
|
|
|
disp('Block = 38'), pause(pstate)
|
|
|
|
disp('Block = 38'), pause(pstate)
|
|
|
@ -553,16 +552,16 @@ toc
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
wafostamp([],'(ER)')
|
|
|
|
disp('Block = 39'), pause(pstate)
|
|
|
|
disp('Block = 39'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
% f_tcac = spec2thpdf(SS,[],'TcAc',[0 12 81],[0:0.2:8],opt1);
|
|
|
|
#! f_tcac = spec2thpdf(SS,[],'TcAc',[0 12 81],[0:0.2:8],opt1);
|
|
|
|
% pdfplot(f_tcac)
|
|
|
|
#! pdfplot(f_tcac)
|
|
|
|
disp('Block = 40'), pause(pstate)
|
|
|
|
disp('Block = 40'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% Section 3.4.4 Joint density of crest and trough height
|
|
|
|
#!#! Section 3.4.4 Joint density of crest and trough height
|
|
|
|
%% Section 3.4.5 Min-to-max distributions – Markov method
|
|
|
|
#!#! Section 3.4.5 Min-to-max distributions <20> Markov method
|
|
|
|
%% Example 11. (min-max problems with Gullfaks data)
|
|
|
|
#!#! Example 11. (min-max problems with Gullfaks data)
|
|
|
|
%% Joint density of maximum and the following minimum
|
|
|
|
#!#! Joint density of maximum and the following minimum
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
tp = dat2tp(yy);
|
|
|
|
tp = dat2tp(yy);
|
|
|
@ -578,7 +577,7 @@ wafostamp([],'(ER)')
|
|
|
|
toc
|
|
|
|
toc
|
|
|
|
disp('Block = 41'), pause(pstate)
|
|
|
|
disp('Block = 41'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
%% The joint density of ”still water separated” maxima and minima.
|
|
|
|
#!#! The joint density of <20>still water separated<65> maxima and minima.
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
ind = find(Mm(:,1)>v & Mm(:,2)<v);
|
|
|
|
ind = find(Mm(:,1)>v & Mm(:,2)<v);
|
|
|
@ -595,7 +594,7 @@ toc
|
|
|
|
disp('Block = 42'), pause(pstate)
|
|
|
|
disp('Block = 42'), pause(pstate)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
#!#!
|
|
|
|
clf
|
|
|
|
clf
|
|
|
|
tic
|
|
|
|
tic
|
|
|
|
facat = kde([Ac At]);
|
|
|
|
facat = kde([Ac At]);
|
|
|
|