1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Histogram and Rayleigh distribuition

  1. Oct 31, 2014 #1
    1. The problem statement, all variables and given/known data
    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'.
    2. Relevant equations
    the histfit equation on matlab

    3. The attempt at a solution
    Use histfit equation to get the histogram and rayleigh distribuition.
     
  2. jcsd
  3. Nov 5, 2014 #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?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Histogram and Rayleigh distribuition
  1. Rayleigh quotient (Replies: 3)

  2. Rayleigh quotient (Replies: 7)

Loading...