How do I make a probability plot of ranges of values below a certain threshold?
1 次查看(过去 30 天)
显示 更早的评论
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.
%Data import
Windspeed_hourly_mean = xlsread('Windspeed_hourly.xlsx','B2:B8763');
WHM=Windspeed_hourly_mean;
%Parameters
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)
plot(windHub,'b')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1141185/image.png)
0 个评论
采纳的回答
dpb
2022-9-30
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
[f,x]=ecdf(durations);
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).
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!