how to use rose diagram appear wind direction and wind speed

11 views (last 30 days)
i have wind data (direction and speed) but i can not know matlab polarhistogram code mean
How can I render a rose diagram with wind speed and direction?

Answers (1)

Ayush
Ayush on 31 Oct 2023
Edited: Ayush on 31 Oct 2023
Hi Peter,
I understand that you want to render the rose diagram for wind direction and speed data.
To plot data in polar format, you can utilize the "deg2rad" function to convert wind directions from degrees to radians. This conversion enables you to create a rose diagram to visualize the data. Below is an example code that provides a clearer understanding of the process:
% Sample wind speed and direction data
wind_speed = [5, 10, 15, 20, 25]; % Wind speeds in m/s
wind_direction = [30, 60, 90, 120, 150]; % Wind directions in degrees
figure
pax = polaraxes;
polarhistogram(deg2rad(wind_direction(wind_speed<=25)),deg2rad(0:10:360),'displayname','20 - 25 m/s')
hold on
polarhistogram(deg2rad(wind_direction(wind_speed<20)),deg2rad(0:10:360),'FaceColor','red','displayname','15 - 20 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<15)),deg2rad(0:10:360),'FaceColor','yellow','displayname','10 - 15 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<10)),deg2rad(0:10:360),'FaceColor','green','displayname','5 - 10 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<5)),deg2rad(0:10:360),'FaceColor','blue','displayname','0 - 5 m/s')
pax.ThetaDir = 'clockwise';
pax.ThetaZeroLocation = 'top';
legend('Show')
title('Wind Rose')
For additional information on the "deg2rad" function and related details, please refer to the following link:
  1. https://www.mathworks.com/help/matlab/ref/deg2rad.html
  2. https://www.mathworks.com/matlabcentral/fileexchange/65174-wind_rose-wind_direction-wind_speed
I hope this helps!
Regards,
Ayush

Categories

Find more on Polar Plots 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!