Histogram and Rayleigh distribuition

In summary, the conversation discusses calculating the histogram for the wave height and wave period, comparing it with the Rayleigh distribution, and using plotting position formulae to calculate the exceedance probability distribution for both wave height and wave period. The code provided is for MATLAB and uses the histfit function to generate the histograms and compare them with the Rayleigh distribution, but the function is currently giving an error. A solution is needed to fix this issue.
  • #1
Jay Sebi
1
0

Homework Statement


  1. (iv) Calculatethehistogramforthewaveheightandwaveperiod.
  2. (v) Compare the histogram with the Rayleigh distribution.
  3. (vi) Calculate exceedance probability distribution for the wave height and wave period using plotting position formulae and compare it with Rayleigh distribution exceedance probability distribution.
I have in MATLAB this code that gives me the periods and wave height for each period.
code:
clc

clear all
filename = '/Users/helenapereira/Desktop/A1-Wave Data.txt';

delimiter = '\t';

startRow = 3;

formatSpec = '%f%f%[^\n\r]';

fileID = fopen(filename,'r');
dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'HeaderLines' ,startRow-1, 'ReturnOnError', false);

fclose(fileID);

Time = dataArray{:, 1};

WAVE = dataArray{:, 2};

clearvars filenamedelimiterstartRowformatSpecfileIDdataArrayans;%%%UPCROSS%%%
% Finding Zeros

ii=1;

for i=1:length(WAVE)-1

if and(WAVE(i)<0,WAVE(i+1)>0)

Indices(ii)=i;

ii=ii+1;

end

end
%Zero Crossing

for i=1:length(Indices)

ZeroCrossing(i)=interp1(WAVE(Indices(i):Indices(i)+1),Time(Indices(i):Indices(i)+1),0,'linear');

end
%Period

ii=1;

for i=1:length(ZeroCrossing)-1

Period(ii)=ZeroCrossing(i+1)-ZeroCrossing(i);

ii=ii+1;

end
%Wave Height

ii=1;

for i=1:length(Indices)-1

Wmax=max(WAVE(Indices(i):Indices(i+1)));

Wmin=min(WAVE(Indices(i):Indices(i+1)));

H(ii)=Wmax-Wmin;

ii=ii+1;

end
%Mean Wave Height

Hmed=mean(H);
%Mean Wave Period

Tmed=mean(Period);
%Hs and H1/10

sort(H,'descend');

a=ceil(length(H)/3);

b=ceil(length(H)/10);

Hs=mean(H(1:a));

Hdec=mean(H(1:b));
%Ts and T1/10

sort(Period,'descend');

c=ceil(length(Period)/3);

d=ceil(length(Period)/10);

Ts=mean(Period(1:c));

Tdec=mean(Period(1:d));

I now need to make the histograms.
however the function histfit gives me the error:
Undefined function 'histfit' for input arguments of
type 'double'.

Homework Equations


the histfit equation on matlab

The Attempt at a Solution


Use histfit equation to get the histogram and rayleigh distribuition.
 
Physics news on Phys.org
  • #2
Thanks for the post! Sorry you aren't generating responses at the moment. Do you have any further information, come to any new conclusions or is it possible to reword the post?
 

What is a histogram?

A histogram is a graphical representation of the distribution of data. It consists of a series of bars, where each bar represents a range of data values and the height of the bar represents the frequency of occurrence of those values.

What is the purpose of a histogram?

The purpose of a histogram is to visually display the distribution of data. It can help to identify patterns, trends, and outliers in the data.

What is a Rayleigh distribution?

A Rayleigh distribution is a probability distribution that is often used to model the magnitude of random variables that have a non-negative value, such as wind speed or wave height. It is characterized by a single parameter, the scale parameter, which determines the shape of the distribution.

What is the relationship between a histogram and a Rayleigh distribution?

A histogram can be used to display the distribution of data that follows a Rayleigh distribution. The shape of the histogram will resemble a bell curve, with the highest frequency of occurrence at the peak of the curve. The curve will also have a long tail on the right side, representing the possibility of higher values occurring.

How is the Rayleigh distribution calculated?

The Rayleigh distribution is calculated using the formula f(x) = (x/σ2) * e-(x2)/2σ2, where x represents the random variable and σ is the scale parameter. This formula can be used to calculate the probability of a given value occurring within the distribution.

Similar threads

Replies
4
Views
679
  • Classical Physics
Replies
27
Views
1K
  • General Engineering
Replies
1
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
725
Replies
4
Views
7K
  • Introductory Physics Homework Help
Replies
13
Views
2K
  • Introductory Physics Homework Help
Replies
31
Views
4K
  • Set Theory, Logic, Probability, Statistics
2
Replies
45
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • Introductory Physics Homework Help
Replies
31
Views
2K
Back
Top