frequency of a specific wind direction in a histogram with hourly intervals
1 回表示 (過去 30 日間)
古いコメントを表示
Hello,
I have 2 vectors (datetime, wind direction). How could i plot a histogram with 2 hour bins (0-2,2-4...22-24) showing the frequency of the wind direction being between 100 and 150 degrees during each of the above intervals.
Thank you very much!
4 件のコメント
Will Nitsch
2017 年 5 月 2 日
Try this:
%%create a bunch of random data
times = [];
windDir = [];
for i = 1:10
times = [times,randperm(24)];
% Note that not all wind directions will be between 100-150 deg
windDir = [windDir, rand(1,24)*360];
end
%%Get the winds with a direction between 100 and 150:
windsIdx = find(windDir <= 150 & windDir >= 100);
hFig = figure;
counts = histcounts(times(windsIdx),[0,2,4,6,8,10,12,14,16,18,20,22,24]);
hHist = histogram('Categories',{'0:00-2:00','2:00-4:00','4:00-6:00','6:00-8:00','8:00-10:00','10:00-12:00','12:00-14:00','14:00-16:00','16:00-18:00','18:00-20:00','20:00-22:00','22:00-24:00'},'BinCounts',counts);
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Waveform Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!