MATLAB风玫瑰图WindRose绘制记录
官方.m文件下载地址
用于创建方向强度直方图,也称为“风玫瑰图”。
内置函数:WindRose()
[figure_handle,count,speeds,directions,Table] = WindRose(direction,speed);
[figure_handle,count,speeds,directions,Table] = WindRose(direction,speed,'parameter1',value1,...);
% Example1:
%----------------------------------------------------------------
d = 360 * rand(10000,1); % My reference is North = 0°, East = 90°.
v = 30*rand(10000,1);
% Default notation with several input arguments
[figure_handle,count,speeds,directions,Table] = WindRose(d,v,'anglenorth',0,'angleeast',90,'labels',{'N (0°)','S (180°)','E (90°)','W (270°)'},'freqlabelangle',45);
% Example2:
% All the wind rose options into a cell array, so function call can be simplified
Properties = {'anglenorth',0,'angleeast',90,'labels',{'N (0°)','S (180°)','E (90°)','W (270°)'},'freqlabelangle',45};
[figure_handle2,count2,speeds2,directions2,Table2] = WindRose(d,v,Properties);
% Example3:
% All the wind rose options into a structure, so function call can be simplified.
Options.AngleNorth = 0;
Options.AngleEast = 90;
Options.Labels = {'N (0°)','S (180°)','E (90°)','W (270°)'};
Options.FreqLabelAngle = 45;
[figure_handle3,count3,speeds3,directions3,Table3] = WindRose(d,v,Options);
绘图注意点:
1、风玫瑰图上所表示的风向即风的来向,是指从外面吹向地区中心的方向。
2、默认风向0°为正北方向,90°为正东方向。
3、如果想修改图表中legend的标题可以在下载的WindRose.m文件中找到对应代码修改。
附:已知风的u、v分量如何计算风向。
参考博客
wdir=mod(270-atan2(v,u)/pi*180,360);
atan2返回的是[-pi,pi]范围内的数值,要转换为角度值。