Fitting Wave Height Data to a Probability Distribution - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Applications and Example Worksheets : Science and Engineering : Fitting Wave Height Data to a Probability Distribution

Fitting Wave Height Data to a Probability Distribution

Introduction

The University of Maine records real-time accelerometer data from buoys deployed in the Gulf of Maine and the Caribbean (http://gyre.umeoce.maine.edu/buoyhome.php). The data can be downloaded from their website, and includes the significant wave height recorded at regular intervals for the last few months.

 

This application does the following:

 

• 

Downloads accelerometer data for Buoy PR206 (located just off the coast of Puerto Rico at a latitude of 18° 28.46' N and a longitude of 66° 5.94' W)

• 

Fits the significant wave height to a Weibull distribution by using two methods: maximum likelihood estimation and moment matching

• 

Plots the fitted distributions on top of a histogram of the experimental data

 

Download and Plot Significant Wave Height Data in a Histogram

> 

restart:

> 

withplots:withStatistics:withOptimization:

> 

url≔http://gyre.umeoce.maine.edu/data/gomoos/buoy/php/view_csv_file.php?ncfile=/data/gomoos/buoy/archive/PR206/realtime/PR206.waves.triaxys.realtime.nc:

> 

data≔ImportMatrixurl

> 

sigWaveHeight≔RemoveNonNumericdata..,2:

> 

n≔numelemssigWaveHeight

n≔8273

(2.1)
> 

numBins≔40:

> 

p1≔HistogramsigWaveHeight,bincount=numBins,color=COLORRGB,150255,40255,27255,thickness=0,style=patchnogrid,transparency=0.5,background=ColorTools:-ColorRGB,236255,240255,241255,axis=gridlines=10,color=RGB1,1,1,axesfont=Arial,labels=Significant Wave Height (m),Distribution,labeldirections=horizontal,vertical,labelfont=Arial,size=800,500:

> 

displayp1

Maximum Likelihood Estimation

> 

P≔unapplyProbabilityDensityFunctionWeibullalpha,beta,t,t,alpha,beta

P≔t&comma;α&comma;β↦0t<0β⋅t−1+β⋅&ExponentialE;−tαβαβotherwise

(3.1)
> 

maxLike:=α&comma;β→addlnPsigWaveHeighti&comma;α&comma;β&comma;i&equals;1..n&colon;

Warning, (in maxLike) `i` is implicitly declared local

> 

resultsMLE≔MaximizemaxLikeα&comma;β&comma;&alpha;&equals;0.01..5&comma;&beta;&equals;0.01..5

resultsMLE≔−4839.27465547207612&comma;α=1.34452570778020&comma;β=2.83250005643047

(3.2)
> 

p2≔plotevalPt&comma;alpha&comma;beta&comma;resultsMLE2 &comma;t&equals;minsigWaveHeight..maxsigWaveHeight&comma;color&equals;black&comma;legend&equals;Maximum Likelihood Estimation&comma;thickness&equals;3&comma;legendstyle&equals;font&equals;Arial&colon;

Moment Matching

> 

resultsMM:=fsolve⁡Moment⁡sigWaveHeight&comma;1&equals;Moment⁡Weibull⁡&alpha;&comma;&beta;&comma;1&comma;Moment⁡sigWaveHeight&comma;2&equals;Moment⁡Weibull⁡&alpha;&comma;&beta;&comma;2&comma;&alpha;&equals;1&comma;&beta;&equals;1

resultsMM≔α=1.342796022&comma;β=2.958762705

(4.1)
> 

p3≔plotevalPt&comma;alpha&comma;beta&comma;resultsMM &comma;t&equals;minsigWaveHeight..maxsigWaveHeight&comma;color&equals;RGB150255&comma;40255&comma;27255&comma;thickness&equals;3&comma;legend&equals;Moment Matching&comma;legendstyle&equals;font&equals;Arial&colon;

Results

> 

displayp1&comma;p2&comma;p3&comma;size&equals;800&comma;500

>