Group wind data in clusters based on direction

6 Ansichten (letzte 30 Tage)
Ancalagon8
Ancalagon8 am 8 Jan. 2023
Kommentiert: Star Strider am 23 Feb. 2023
I have an annual table with wind direction values and I want to group them per month in 16 sectors based on the degrees.
Is it possible to do it automatically either than manually?
  5 Kommentare
Ancalagon8
Ancalagon8 am 9 Jan. 2023
@Adam Danz, @Walter Roberson thank you for your detailed and well-explained answers.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 8 Jan. 2023
Bearbeitet: Star Strider am 8 Jan. 2023
One way to do this would be to use the histcounts function and get the first three outputs —
WindDir = rand(100,1)*360;
edgev = linspace(0, 360, 9);
[N,Edges,Octant] = histcounts(WindDir, edgev);
WindOctants = table(WindDir,Octant)
WindOctants = 100×2 table
WindDir Octant _______ ______ 123.39 3 272.97 7 352.43 8 10.679 1 199.56 5 205.31 5 258.28 6 329.39 8 146.07 4 171.63 4 333.69 8 328.55 8 85.531 2 331.01 8 92.321 3 232.95 6
The first output are the number of counts in each octant (bonus information), and the third is the respective octant.
EDIT — (8 Jan 2023 at 16:30)
Added table.
.
  20 Kommentare
Star Strider
Star Strider am 23 Feb. 2023
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by