How do I make a probability plot of ranges of values below a certain threshold?
6 views (last 30 days)
I plotted a yearly wind profile and calculated that the maximum consecutive hours below a threshold of 3 m/s is 43h. For this I used the code below. Now I want to know often this time period of 43h occurs and how often 42h, 41h, 40h,...,1h occur. For that reason I want to make a distribution plot of every time period up to 43h on the x-axis and the % of time it occurs on the y-axis, but how?
You can find the wind speed profile below.
Windspeed_hourly_mean = xlsread('Windspeed_hourly.xlsx','B2:B8763');
threshold = 3;
windHeight = 50;
hubHeight = 150;
%Windspeed calculation at hub height
wind60 = WHM .* log(60/0.0001) ./ log(windHeight/0.0001);
windHub = wind60 .* (hubHeight ./ 60) .^ 0.115;
isBelow = (windHub < threshold); % gives us a vector of logical values
isBelow = [false; isBelow; false]; % make sure the vector starts and ends with false
transitions = diff(isBelow); % gives 1 where false->true and -1 where true->false
starts = find(transitions==1); % indexes of where each period starts
ends = find(transitions==-1); % indexes of where each period ends
durations = ends - starts;
max(durations); % largest duration
t_delta = max(durations)
dpb on 30 Sep 2022
The Q? asked is
t_delta = max(durations); % strange variable name???
n=histc(durations,1:t_delta); % counts by bins 1:max duration
To compute an empircal cdf; if have Statistics Toolbox
which is minimal form with any duplicated counts removed from the result (no zero bin locations in the output, only where the ecdf changes values reported).