Filter löschen
Filter löschen

frequency of a specific wind direction in a histogram with hourly intervals

2 Ansichten (letzte 30 Tage)
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 Kommentare
Will Nitsch
Will Nitsch am 2 Mai 2017
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);

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Animation finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by