Filter data based on wind direction
Show older comments
Dear reader,
Currently I am working with a dataset consisting of windspeeds (v) and directions (phi) in several locations. I need to filter the dataset based on wind direction. That is, I have determined the dominant wind directions at each of the locations and need to remove all the data outside dominant direction +/- 30 degrees. This is of course no problem when the dominant wave direction is anywhere between 30 and 330 degrees. However, when the dominant direction is less than 30 degrees or more than 330 degrees, it becomes problematic since 360 degrees is equal to 0 degrees (North).
Let's say I have:
v = rand(1000,1)*15 % Wind speed between 0 and 15 m/s
phi = rand(1000,1)*360 % Wind direction between 0 and 360 degrees North
It should not be difficult, but I cannot figure it out. What is an easy solution to filter the dataset based on the wind direction so that it accounts for the fact that the wind direction is in fact circular data?
Many thanks in advance!
Answers (1)
Michiel Smit
on 22 Mar 2022
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!