"source": "CHAPTER 1 demonstrates some applications of WAFO"
"source": [
"CHAPTER 1 demonstrates some applications of WAFO"
]
},
},
{
{
"cell_type": "raw",
"cell_type": "raw",
"metadata": {},
"metadata": {},
"source": "CHAPTER1 gives an overview through examples some of the capabilities of WAFO. WAFO is a toolbox of Matlab routines for statistical analysis and simulation of random waves and loads. The commands are edited for fast computation.\n"
"source": [
"CHAPTER1 gives an overview through examples some of the capabilities of WAFO. WAFO is a toolbox of Matlab routines for statistical analysis and simulation of random waves and loads. The commands are edited for fast computation.\n"
]
},
},
{
{
"cell_type": "heading",
"cell_type": "heading",
"level": 2,
"level": 2,
"metadata": {},
"metadata": {},
"source": "Section 1.4 Some applications of WAFO"
"source": [
"Section 1.4 Some applications of WAFO"
]
},
},
{
{
"cell_type": "heading",
"cell_type": "heading",
"level": 3,
"level": 3,
"metadata": {},
"metadata": {},
"source": "Section 1.4.1 Simulation from spectrum, estimation of spectrum "
"source": [
"Section 1.4.1 Simulation from spectrum, estimation of spectrum "
]
},
},
{
{
"cell_type": "raw",
"cell_type": "raw",
"metadata": {},
"metadata": {},
"source": "Simulation of the sea surface from spectrum. The following code generates 200 seconds of data sampled with 10Hz from the Torsethaugen spectrum."
"source": [
"Simulation of the sea surface from spectrum. The following code generates 200 seconds of data sampled with 10Hz from the Torsethaugen spectrum."
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"collapsed": false,
"collapsed": false,
"input": "import wafo.spectrum.models as wsm\nS = wsm.Torsethaugen(Hm0=6, Tp=8);\nS1 = S.tospecdata()\nS1.plot()\nshow()",
"input": [
"import wafo.spectrum.models as wsm\n",
"S = wsm.Torsethaugen(Hm0=6, Tp=8);\n",
"S1 = S.tospecdata()\n",
"S1.plot()\n",
"show()"
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
@ -52,7 +68,13 @@
{
{
"cell_type": "code",
"cell_type": "code",
"collapsed": false,
"collapsed": false,
"input": "import wafo.objects as wo\nxs = S1.sim(ns=2000, dt=0.1)\nts = wo.mat2timeseries(xs)\nts.plot_wave('-')\nshow()",
"input": [
"import wafo.objects as wo\n",
"xs = S1.sim(ns=2000, dt=0.1)\n",
"ts = wo.mat2timeseries(xs)\n",
"ts.plot_wave('-')\n",
"show()"
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
@ -67,17 +89,31 @@
"cell_type": "heading",
"cell_type": "heading",
"level": 4,
"level": 4,
"metadata": {},
"metadata": {},
"source": "Estimation of spectrum "
"source": [
"Estimation of spectrum "
]
},
},
{
{
"cell_type": "raw",
"cell_type": "raw",
"metadata": {},
"metadata": {},
"source": "A common situation is that one wants to estimate the spectrum for wave measurements. The following code simulate 20 minutes signal sampled at 4Hz and compare the spectral estimate with the original Torsethaugen spectum.\n"
"source": [
"A common situation is that one wants to estimate the spectrum for wave measurements. The following code simulate 20 minutes signal sampled at 4Hz and compare the spectral estimate with the original Torsethaugen spectum.\n"
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"collapsed": false,
"collapsed": false,
"input": "clf()\nFs = 4; \nxs = S1.sim(ns=fix(20 * 60 * Fs), dt=1. / Fs) \nts = wo.mat2timeseries(xs) \nSest = ts.tospecdata(L=400)\nS1.plot()\nSest.plot('--')\naxis([0, 3, 0, 5]) # This may depend on the simulation\nshow()",
"axis([0, 3, 0, 5]) # This may depend on the simulation\n",
"show()"
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
@ -92,17 +128,35 @@
"cell_type": "heading",
"cell_type": "heading",
"level": 3,
"level": 3,
"metadata": {},
"metadata": {},
"source": "Section 1.4.2 Probability distributions of wave characteristics."
"source": [
"Section 1.4.2 Probability distributions of wave characteristics."
]
},
},
{
{
"cell_type": "raw",
"cell_type": "raw",
"metadata": {},
"metadata": {},
"source": "Probability distribution of wave trough period: WAFO gives the possibility of computing the exact probability distributions for a number of characteristics given a spectral density. In the following example we study the trough period extracted from the time series and compared with the theoretical density computed with exact spectrum, S1, and the estimated spectrum, Sest.\n"
"source": [
"Probability distribution of wave trough period: WAFO gives the possibility of computing the exact probability distributions for a number of characteristics given a spectral density. In the following example we study the trough period extracted from the time series and compared with the theoretical density computed with exact spectrum, S1, and the estimated spectrum, Sest.\n"
"source": "Here are a few lines of code, which produce directional spectra with frequency independent and frequency dependent spreading."
"source": [
"Here are a few lines of code, which produce directional spectra with frequency independent and frequency dependent spreading."
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"collapsed": false,
"collapsed": false,
"input": "clf()\nplotflag = 1\nNt = 101; # number of angles\nth0 = pi / 2; # primary direction of waves\nSp = 15; # spreading parameter\n\nD1 = wsm.Spreading(type='cos', theta0=th0, method=None) # frequency independent\nD12 = wsm.Spreading(type='cos', theta0=0, method='mitsuyasu') # frequency dependent\n\nSD1 = D1.tospecdata2d(S1)\nSD12 = D12.tospecdata2d(S1)\nSD1.plot()\nSD12.plot()#linestyle='dashdot')\nshow()",
"input": [
"clf()\n",
"plotflag = 1\n",
"Nt = 101; # number of angles\n",
"th0 = pi / 2; # primary direction of waves\n",
"Sp = 15; # spreading parameter\n",
"\n",
"D1 = wsm.Spreading(type='cos', theta0=th0, method=None) # frequency independent\n",
"D12 = wsm.Spreading(type='cos', theta0=0, method='mitsuyasu') # frequency dependent\n",
"\n",
"SD1 = D1.tospecdata2d(S1)\n",
"SD12 = D12.tospecdata2d(S1)\n",
"SD1.plot()\n",
"SD12.plot()#linestyle='dashdot')\n",
"show()"
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
@ -142,23 +215,38 @@
"cell_type": "heading",
"cell_type": "heading",
"level": 4,
"level": 4,
"metadata": {},
"metadata": {},
"source": "3D Simulation of the sea surface "
"source": [
"3D Simulation of the sea surface "
]
},
},
{
{
"cell_type": "raw",
"cell_type": "raw",
"metadata": {},
"metadata": {},
"source": "The simulations show that frequency dependent spreading leads to much more irregular surface so the orientation of waves is less transparent compared to the frequency independent case."
"source": [
"The simulations show that frequency dependent spreading leads to much more irregular surface so the orientation of waves is less transparent compared to the frequency independent case."
"source": "Section 1.4.4 Fatigue, Load cycles and Markov models"
"source": [
"Section 1.4.4 Fatigue, Load cycles and Markov models"
]
},
},
{
{
"cell_type": "raw",
"cell_type": "raw",
"metadata": {},
"metadata": {},
"source": "Switching Markow chain of turningpoints.\nIn fatigue applications the exact sample path is not important, but only the tops and bottoms of the load, called the sequence of turning points (TP). From the turning points one can extract load cycles, from which damage calculations and fatigue life predictions can be performed.\n\nThe commands below computes the intensity of rainflowcycles for the Gaussian model with spectrum S1 using the Markov approximation. \nThe rainflow cycles found in the simulated load signal are shown in the figure."
"source": [
"Switching Markow chain of turningpoints.\n",
"In fatigue applications the exact sample path is not important, but only the tops and bottoms of the load, called the sequence of turning points (TP). From the turning points one can extract load cycles, from which damage calculations and fatigue life predictions can be performed.\n",
"\n",
"The commands below computes the intensity of rainflowcycles for the Gaussian model with spectrum S1 using the Markov approximation. \n",
"The rainflow cycles found in the simulated load signal are shown in the figure."
"text": "c:\\pab\\workspace\\pywafo_svn\\pywafo\\src\\wafo\\stats\\estimation.py:1080: UserWarning: P-value is on the conservative side (i.e. too large) due to ties in the data!\n warnings.warn('P-value is on the conservative side (i.e. too large) due to ties in the data!')\n"
"text": [
"c:\\pab\\workspace\\pywafo_svn\\pywafo\\src\\wafo\\stats\\estimation.py:1080: UserWarning: P-value is on the conservative side (i.e. too large) due to ties in the data!\n",
" warnings.warn('P-value is on the conservative side (i.e. too large) due to ties in the data!')\n"
"source": "CHAPTER2 Modelling random loads and stochastic waves\n====================================================\n\nChapter2 contains the commands used in Chapter 2 of the tutorial and present some tools for analysis of random functions with respect to their correlation, spectral and distributional properties. The presentation is divided into three examples: \n\nExample1 is devoted to estimation of different parameters in the model.\nExample2 deals with spectral densities and\nExample3 presents the use of WAFO to simulate samples of a Gaussian process.\n\nSome of the commands are edited for fast computation. \n\nSection 2.1 Introduction and preliminary analysis\n=================================================\n\nExample 1: Sea data\n-------------------\nObserved crossings compared to the expected for Gaussian signals\n"
"source": [
"CHAPTER2 Modelling random loads and stochastic waves\n",
"Chapter2 contains the commands used in Chapter 2 of the tutorial and present some tools for analysis of random functions with respect to their correlation, spectral and distributional properties. The presentation is divided into three examples: \n",
"\n",
"Example1 is devoted to estimation of different parameters in the model.\n",
"Example2 deals with spectral densities and\n",
"Example3 presents the use of WAFO to simulate samples of a Gaussian process.\n",
"\n",
"Some of the commands are edited for fast computation. \n",
"\n",
"Section 2.1 Introduction and preliminary analysis\n",
"source": "Average number of upcrossings per time unit\n----------------------------------------------\nNext we compute the mean frequency as the average number of upcrossings per time unit of the mean level (= 0); this may require interpolation in the crossing intensity curve, as follows. \n"
"Next we compute the mean frequency as the average number of upcrossings per time unit of the mean level (= 0); this may require interpolation in the crossing intensity curve, as follows. \n"
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"collapsed": false,
"collapsed": false,
"input": "T = xx[:, 0].max() - xx[:, 0].min()\nf0 = np.interp(0, lc.args, lc.data, 0) / T #! zero up-crossing frequency \nprint('f0 = %g' % f0)",
"input": [
"T = xx[:, 0].max() - xx[:, 0].min()\n",
"f0 = np.interp(0, lc.args, lc.data, 0) / T #! zero up-crossing frequency \n",
"print('f0 = %g' % f0)"
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"output_type": "stream",
"output_type": "stream",
"stream": "stdout",
"stream": "stdout",
"text": "f0 = 0.224071\n"
"text": [
"f0 = 0.224071\n"
]
}
}
],
],
"prompt_number": 3
"prompt_number": 3
@ -49,19 +91,29 @@
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {},
"metadata": {},
"source": "Turningpoints and irregularity factor\n----------------------------------------"
"source": [
"Turningpoints and irregularity factor\n",
"----------------------------------------"
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"collapsed": false,
"collapsed": false,
"input": "fm = len(tp.data) / (2 * T) # frequency of maxima\nalfa = f0 / fm # approx Tm24/Tm02\n\nprint('fm = %g, alpha = %g, ' % (fm, alfa))",
"input": [
"fm = len(tp.data) / (2 * T) # frequency of maxima\n",
"alfa = f0 / fm # approx Tm24/Tm02\n",
"\n",
"print('fm = %g, alpha = %g, ' % (fm, alfa))"
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"output_type": "stream",
"output_type": "stream",
"stream": "stdout",
"stream": "stdout",
"text": "fm = 0.456159, alpha = 0.491212, \n"
"text": [
"fm = 0.456159, alpha = 0.491212, \n"
]
}
}
],
],
"prompt_number": 4
"prompt_number": 4
@ -69,12 +121,23 @@
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {},
"metadata": {},
"source": "Visually examine data\n------------------------\nWe finish this section with some remarks about the quality of the measured data. Especially sea surface measurements can be of poor quality. We shall now check the quality of the dataset {\\tt xx}. It is always good practice to visually examine the data before the analysis to get an impression of the quality, \nnon-linearities and narrow-bandedness of the data.First we shall plot the data and zoom in on a specific region. A part of sea data is visualized with the following commands"
"source": [
"Visually examine data\n",
"------------------------\n",
"We finish this section with some remarks about the quality of the measured data. Especially sea surface measurements can be of poor quality. We shall now check the quality of the dataset {\\tt xx}. It is always good practice to visually examine the data before the analysis to get an impression of the quality, \n",
"non-linearities and narrow-bandedness of the data.First we shall plot the data and zoom in on a specific region. A part of sea data is visualized with the following commands"
"source": "Finding possible spurious points\n------------------------------------\nHowever, if the amount of data is too large for visual examinations one could use the following criteria to find possible spurious points. One must be careful using the criteria for extremevalue analysis, because\nit might remove extreme waves that are OK and not spurious."
"source": [
"Finding possible spurious points\n",
"------------------------------------\n",
"However, if the amount of data is too large for visual examinations one could use the following criteria to find possible spurious points. One must be careful using the criteria for extremevalue analysis, because\n",
"it might remove extreme waves that are OK and not spurious."
"source": " Estimated autocovariance\n----------------------------\nObviously knowing the spectrum one can compute the covariance\nfunction. The following code will compute the covariance for the \nunimodal spectral density S1 and compare it with estimated \ncovariance of the signal xx."
"source": [
" Estimated autocovariance\n",
"----------------------------\n",
"Obviously knowing the spectrum one can compute the covariance\n",
"function. The following code will compute the covariance for the \n",
"unimodal spectral density S1 and compare it with estimated \n",
"source": "We can see in Figure below that the covariance function corresponding to the spectral density S2 significantly differs from the one estimated directly from data. It can be seen in Figure above that the covariance corresponding to S1 agrees much better with the estimated covariance function."
"source": [
"We can see in Figure below that the covariance function corresponding to the spectral density S2 significantly differs from the one estimated directly from data. It can be seen in Figure above that the covariance corresponding to S1 agrees much better with the estimated covariance function."
"source": "Section 2.2.2 Transformed Gaussian models\n-------------------------------------------\nWe begin with computing skewness and kurtosis for the data set xx and compare it with the second order wave approximation proposed by Winterstein:"
"source": [
"Section 2.2.2 Transformed Gaussian models\n",
"-------------------------------------------\n",
"We begin with computing skewness and kurtosis for the data set xx and compare it with the second order wave approximation proposed by Winterstein:"
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"collapsed": false,
"collapsed": false,
"input": "import wafo.stats as ws\nrho3 = ws.skew(xx[:, 1])\nrho4 = ws.kurtosis(xx[:, 1])\n\nsk, ku = S1.stats_nl(moments='sk')",
"input": [
"import wafo.stats as ws\n",
"rho3 = ws.skew(xx[:, 1])\n",
"rho4 = ws.kurtosis(xx[:, 1])\n",
"\n",
"sk, ku = S1.stats_nl(moments='sk')"
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
@ -218,12 +368,26 @@
{
{
"cell_type": "raw",
"cell_type": "raw",
"metadata": {},
"metadata": {},
"source": "Comparisons of 3 transformations"
"source": [
"Comparisons of 3 transformations"
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"collapsed": false,
"collapsed": false,
"input": "clf()\nimport wafo.transform.models as wtm\ngh = wtm.TrHermite(mean=me, sigma=sa, skew=sk, kurt=ku).trdata()\ng = wtm.TrLinear(mean=me, sigma=sa).trdata() # Linear transformation \nglc, gemp = lc.trdata(mean=me, sigma=sa)\n\nglc.plot('b-') #! Transf. estimated from level-crossings\ngh.plot('b-.') #! Hermite Transf. estimated from moments\ng.plot('r')\ngrid('on')\nshow()",
"g = wtm.TrLinear(mean=me, sigma=sa).trdata() # Linear transformation \n",
"glc, gemp = lc.trdata(mean=me, sigma=sa)\n",
"\n",
"glc.plot('b-') #! Transf. estimated from level-crossings\n",
"gh.plot('b-.') #! Hermite Transf. estimated from moments\n",
"g.plot('r')\n",
"grid('on')\n",
"show()"
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
@ -237,19 +401,37 @@
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {},
"metadata": {},
"source": "Test Gaussianity of a stochastic process\n------------------------------------------\nTESTGAUSSIAN simulates e(g(u)-u) = int (g(u)-u)^2 du for Gaussian processes given the spectral density, S. The result is plotted if test0 is given. This is useful for testing if the process X(t) is Gaussian.\nIf 95% of TEST1 is less than TEST0 then X(t) is not Gaussian at a 5% level.\n\nAs we see from the figure below: none of the simulated values of test1 is above 1.00. Thus the data significantly departs from a Gaussian distribution. "
"source": [
"Test Gaussianity of a stochastic process\n",
"------------------------------------------\n",
"TESTGAUSSIAN simulates e(g(u)-u) = int (g(u)-u)^2 du for Gaussian processes given the spectral density, S. The result is plotted if test0 is given. This is useful for testing if the process X(t) is Gaussian.\n",
"If 95% of TEST1 is less than TEST0 then X(t) is not Gaussian at a 5% level.\n",
"\n",
"As we see from the figure below: none of the simulated values of test1 is above 1.00. Thus the data significantly departs from a Gaussian distribution. "
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"collapsed": false,
"collapsed": false,
"input": "clf()\ntest0 = glc.dist2gauss()\n# the following test takes time\nN = len(xx)\ntest1 = S1.testgaussian(ns=N, cases=50, test0=test0)\nis_gaussian = sum(test1 > test0) > 5 \nprint(is_gaussian)\nshow()",
"source": "Normalplot of data xx\n------------------------\nindicates that the underlying distribution has a \"heavy\" upper tail and a \"light\" lower tail."
"source": [
"Normalplot of data xx\n",
"------------------------\n",
"indicates that the underlying distribution has a \"heavy\" upper tail and a \"light\" lower tail."
"input": "#clf()\n#Se = spec2spec(Sd,'encdir',0,10);\n#plotspec(Se), hold on\n#plotspec(Sd,1,'--'), hold off\n##!wafostamp('','(ER)')\n#disp('Block = 17'),pause(pstate)\n#\n##!#! Frequency spectra\n#clf\n#Sd1 =spec2spec(Sd,'freq');\n#Sd2 = spec2spec(Se,'enc');\n#plotspec(spec), hold on\n#plotspec(Sd1,1,'.'),\n#plotspec(Sd2),\n##!wafostamp('','(ER)')\n#hold off\n#disp('Block = 18'),pause(pstate)\n#\n##!#! Wave number spectrum\n#clf\n#Sk = spec2spec(spec,'k1d')\n#Skd = spec2spec(Sd,'k1d')\n#plotspec(Sk), hold on\n#plotspec(Skd,1,'--'), hold off\n##!wafostamp('','(ER)')\n#disp('Block = 19'),pause(pstate)\n#\n##!#! Effect of waterdepth on spectrum\n#clf\n#plotspec(spec,1,'--'), hold on\n#S20 = spec;\n#S20.S = S20.S.*phi1(S20.w,20);\n#S20.h = 20;\n#plotspec(S20), hold off\n##!wafostamp('','(ER)')\n#disp('Block = 20'),pause(pstate)\n#\n##!#! Section 2.3 Simulation of transformed Gaussian process\n##!#! Example 3: Simulation of random sea \n##! The reconstruct function replaces the spurious points of seasurface by\n##! simulated data on the basis of the remaining data and a transformed Gaussian\n##! process. As noted previously one must be careful using the criteria \n##! for finding spurious points when reconstructing a dataset, because\n##! these criteria might remove the highest and steepest waves as we can see\n##! in this plot where the spurious points is indicated with a '+' sign:\n##!\n#clf\n#[y, grec] = reconstruct(xx,inds);\n#waveplot(y,'-',xx(inds,:),'+',1,1)\n#axis([0 inf -inf inf])\n##!wafostamp('','(ER)')\n#disp('Block = 21'),pause(pstate)\n#\n##! Compare transformation (grec) from reconstructed (y) \n##! with original (glc) from (xx)\n#clf\n#trplot(g), hold on\n#plot(gemp(:,1),gemp(:,2))\n#plot(glc(:,1),glc(:,2),'-.')\n#plot(grec(:,1),grec(:,2)), hold off \n#disp('Block = 22'),pause(pstate)\n#\n##!#!\n#clf\n#L = 200;\n#x = dat2gaus(y,grec);\n#Sx = dat2spec(x,L);\n#disp('Block = 23'),pause(pstate)\n# \n##!#!\n#clf\n#dt = spec2dt(Sx)\n#Ny = fix(2*60/dt) #! = 2 minutes\n#Sx.tr = grec;\n#ysim = spec2sdat(Sx,Ny);\n#waveplot(ysim,'-')\n##!wafostamp('','(CR)')\n#disp('Block = 24'),pause(pstate)\n\n",
"input": [
"#clf()\n",
"#Se = spec2spec(Sd,'encdir',0,10);\n",
"#plotspec(Se), hold on\n",
"#plotspec(Sd,1,'--'), hold off\n",
"##!wafostamp('','(ER)')\n",
"#disp('Block = 17'),pause(pstate)\n",
"#\n",
"##!#! Frequency spectra\n",
"#clf\n",
"#Sd1 =spec2spec(Sd,'freq');\n",
"#Sd2 = spec2spec(Se,'enc');\n",
"#plotspec(spec), hold on\n",
"#plotspec(Sd1,1,'.'),\n",
"#plotspec(Sd2),\n",
"##!wafostamp('','(ER)')\n",
"#hold off\n",
"#disp('Block = 18'),pause(pstate)\n",
"#\n",
"##!#! Wave number spectrum\n",
"#clf\n",
"#Sk = spec2spec(spec,'k1d')\n",
"#Skd = spec2spec(Sd,'k1d')\n",
"#plotspec(Sk), hold on\n",
"#plotspec(Skd,1,'--'), hold off\n",
"##!wafostamp('','(ER)')\n",
"#disp('Block = 19'),pause(pstate)\n",
"#\n",
"##!#! Effect of waterdepth on spectrum\n",
"#clf\n",
"#plotspec(spec,1,'--'), hold on\n",
"#S20 = spec;\n",
"#S20.S = S20.S.*phi1(S20.w,20);\n",
"#S20.h = 20;\n",
"#plotspec(S20), hold off\n",
"##!wafostamp('','(ER)')\n",
"#disp('Block = 20'),pause(pstate)\n",
"#\n",
"##!#! Section 2.3 Simulation of transformed Gaussian process\n",
"##!#! Example 3: Simulation of random sea \n",
"##! The reconstruct function replaces the spurious points of seasurface by\n",
"##! simulated data on the basis of the remaining data and a transformed Gaussian\n",
"##! process. As noted previously one must be careful using the criteria \n",
"##! for finding spurious points when reconstructing a dataset, because\n",
"##! these criteria might remove the highest and steepest waves as we can see\n",
"##! in this plot where the spurious points is indicated with a '+' sign:\n",
"##!\n",
"#clf\n",
"#[y, grec] = reconstruct(xx,inds);\n",
"#waveplot(y,'-',xx(inds,:),'+',1,1)\n",
"#axis([0 inf -inf inf])\n",
"##!wafostamp('','(ER)')\n",
"#disp('Block = 21'),pause(pstate)\n",
"#\n",
"##! Compare transformation (grec) from reconstructed (y) \n",
"##! with original (glc) from (xx)\n",
"#clf\n",
"#trplot(g), hold on\n",
"#plot(gemp(:,1),gemp(:,2))\n",
"#plot(glc(:,1),glc(:,2),'-.')\n",
"#plot(grec(:,1),grec(:,2)), hold off \n",
"#disp('Block = 22'),pause(pstate)\n",
"#\n",
"##!#!\n",
"#clf\n",
"#L = 200;\n",
"#x = dat2gaus(y,grec);\n",
"#Sx = dat2spec(x,L);\n",
"#disp('Block = 23'),pause(pstate)\n",
"# \n",
"##!#!\n",
"#clf\n",
"#dt = spec2dt(Sx)\n",
"#Ny = fix(2*60/dt) #! = 2 minutes\n",
"#Sx.tr = grec;\n",
"#ysim = spec2sdat(Sx,Ny);\n",
"#waveplot(ysim,'-')\n",
"##!wafostamp('','(CR)')\n",
"#disp('Block = 24'),pause(pstate)\n",
"\n"
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
"outputs": []
"outputs": []
@ -331,12 +627,24 @@
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {},
"metadata": {},
"source": "Estimated spectrum compared to Torsethaugen spectrum\n-------------------------------------------------------"
"source": [
"Estimated spectrum compared to Torsethaugen spectrum\n",