% CHAPTER1 demonstrates some applications of WAFO 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. Each set of commands is followed by a 'pause' command. Type 'pause off' to disable them.

- dat2spec
- dat2tp
- dat2wa
- mkdspec
- pdfplot
- seasim
- spec2cmat
- spec2sdat
- spec2tpdf
- spreading
- torsethaugen
- tp2rfc
- wafostamp
- waveplot
- whisto
- wspecplot

Estimate one-sided spectral density from data. | |

Extracts turning points from data, | |

Extracts sequence of wavelengths from data. | |

Make a directional spectrum | |

Plot contents of pdf structures | |

Spectral simulation of a Gaussian sea, 2D (x,t) or 3D (x,y,t) | |

Joint intensity matrix for cycles (max,min)-, rainflow- and (crest,trough) | |

Simulates a Gaussian process and its derivative from spectrum | |

Evaluates densities for crest-,trough-period, length. | |

Directional spreading functions | |

Calculates a double peaked (swell + wind) spectrum | |

Finds the rainflow cycles from the sequence of turning points. | |

Prints a caption "made by WAFO" in current figure. | |

Plots the surface elevation of timeseries. | |

Plots a histogram | |

Plot a spectral density |

001 %% CHAPTER1 demonstrates some applications of WAFO 002 % 003 % CHAPTER1 gives an overview through examples some of the capabilities of 004 % WAFO. WAFO is a toolbox of Matlab routines for statistical analysis and 005 % simulation of random waves and loads. 006 % 007 % The commands are edited for fast computation. 008 % Each set of commands is followed by a 'pause' command. 009 % Type 'pause off' to disable them. 010 011 % Tested on Matlab 5.3, 7.0 012 % History 013 % Revised pab sept2005 014 % Added sections -> easier to evaluate using cellmode evaluation. 015 % Revised pab Dec 2004 016 % Added support for publish.m command in matlab R14 017 % Created by GL July 13, 2000 018 % from commands used in Chapter 1 of the tutorial 019 020 pstate = 'off' 021 022 %% Section 1.4 Some applications of WAFO 023 024 %% Section 1.4.1 Simulation from spectrum, estimation of spectrum 025 %% Simulation of the sea surface from spectrum 026 %The following code generates 200 seconds of data sampled with 10Hz from 027 %the Torsethaugen spectrum 028 Hm0 = 6; 029 Tp = 8; 030 S1=torsethaugen([],[Hm0 Tp],1); 031 clf 032 dt = 0.1; 033 N = 2000; 034 xs=spec2sdat(S1,N,dt); 035 036 clf 037 waveplot(xs,'-') 038 wafostamp([],'(ER)') 039 pause(pstate) 040 041 %% Estimation of spectrum 042 %A common situation is that one wants to estimate the spectrum for wave 043 %measurements. The following code simulate 20 minutes signal sampled at 4Hz 044 %and compare the spectral estimate with the original Torsethaugen spectum. 045 clf 046 xs=spec2sdat(S1,[20*60*4 1],0.25); 047 Sest = dat2spec(xs,400) 048 wspecplot(Sest,1,'--'), hold on 049 wspecplot(S1,1), hold off 050 axis([0 3 0 5]) 051 wafostamp([],'(ER)') 052 pause(pstate) 053 054 055 %% Section 1.4.2 Probability distributions of wave characteristics. 056 %% Probability distribution of wave trough period 057 %WAFO gives the possibility of computing the exact probability 058 %distributions for a number of characteristics given a spectral density. 059 %In the following example we study the trough period extracted from the 060 %time series and compared with the theoretical density computed with exact 061 %spectrum, S1, and the estimated spectrum, Sest. 062 063 clf 064 [T, index] = dat2wa(xs,0,'d2u'); 065 whisto(T,25,1,1), hold on 066 dtyex = spec2tpdf(S1,[],'Tt',[0 10 51],0,3); 067 dtyest = spec2tpdf(Sest,[],'Tt',[0 10 51],0,3); 068 pdfplot(dtyex) 069 pdfplot(dtyest,'-.') 070 axis([0 10 0 0.35]), hold off 071 wafostamp([],'(ER)') 072 pause(pstate) 073 074 %% Section 1.4.3 Directional spectra 075 %Here are a few lines of code, which produce directional spectra 076 %with frequency independent and frequency dependent spreading. 077 clf 078 D1 = spreading(101,'cos',pi/2,[15],[],0); % frequency independent 079 D12 = spreading(101,'cos',0,[15],S1.w,1); % frequency dependent 080 SD1 = mkdspec(S1,D1); 081 SD12 = mkdspec(S1,D12); 082 wspecplot(SD1,1), hold on, wspecplot(SD12,1,'-.'); hold off 083 wafostamp([],'(ER)') 084 pause(pstate) 085 086 087 %% 3D Simulation of the sea surface 088 % The simulations show that frequency dependent spreading leads to 089 % much more irregular surface so the orientation of waves is less 090 % transparent compared to the frequency independent case. 091 092 % Frequency independent spreading 093 Y1=seasim(SD1,2^8,2^8,1,0.5,0.5,0.25,2,1); 094 wafostamp([],'(ER)') 095 pause(pstate) 096 %% 097 % Frequency dependent spreading 098 Y12=seasim(SD12,2^8,2^8,1,0.5,0.5,0.25,2,1); 099 wafostamp([],'(ER)') 100 pause(pstate) 101 102 %% Section 1.4.4 Fatigue, Load cycles and Markov models. 103 %% Switching Markow chain of turningpoints 104 % Here the Markov approximation for computing the intensity of 105 % rainflowcycles for the Gaussian model with spectrum S1 106 clf 107 frfc=spec2cmat(S1,[],'rfc',[],[-6 6 61]); 108 pdfplot(frfc); 109 hold on 110 tp=dat2tp(xs); 111 rfc=tp2rfc(tp); 112 plot(rfc(:,2),rfc(:,1),'.') 113 wafostamp([],'(ER)') 114 hold off 115

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