【免费】基于Matlab画风玫瑰图

1,298次阅读
没有评论

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab完整代码及仿真定制内容点击👇

智能优化算法       神经网络预测       雷达通信      无线传感器        电力系统

信号处理              图像处理               路径规划       元胞自动机        无人机

🔥 内容介绍

风玫瑰图是一种数据可视化工具,用于展示风向和风速的分布情况。它是一种极坐标图,以圆形为基础,将风向表示为角度,风速表示为半径。风玫瑰图通常用于气象学、地理学和环境科学领域,帮助研究人员和决策者更好地理解和分析风的特征和趋势。

风玫瑰图的基本原理是将一定时间内的风向和风速数据转换为可视化的图形。在图表的中心点,通常是一个圆圈或一个点,表示无风或风速非常低的情况。从中心点开始,每个方向的扇形区域代表该方向上的风向,扇形的大小则表示风速的大小。通常情况下,扇形区域的颜色或阴影也可以用来表示风速的强度。

风玫瑰图的优势在于它能够直观地展示风向和风速的分布情况。通过观察图表,我们可以很容易地看出哪个方向上的风速较高,哪个方向上的风速较低。同时,风玫瑰图还能够显示出风向和风速的频率分布,帮助我们了解不同风速区间的占比情况。

在气象学中,风玫瑰图被广泛应用于分析和研究气候变化、风暴活动以及风资源评估等领域。例如,在风能行业中,风玫瑰图可以帮助评估风能资源的分布情况,确定最佳的风能发电场址。此外,风玫瑰图还可以用于研究城市风环境,分析建筑物和城市规划对风速和风向的影响。

除了气象学领域,风玫瑰图还可以应用于其他领域,例如海洋学、航海和航空等。在海洋学中,风玫瑰图可以帮助研究海洋表面风的分布情况,对海洋环境和生态系统的研究具有重要意义。在航海和航空中,风玫瑰图可以用于船舶和飞机的航行计划,帮助确定最佳的航线和飞行高度,以提高安全性和效率。

尽管风玫瑰图在许多领域中都有广泛的应用,但它也存在一些限制。首先,风玫瑰图只能表示风向和风速的分布情况,无法提供其他气象要素的信息。其次,风玫瑰图对数据的质量和采样频率要求较高,如果数据不准确或不完整,可能会导致图表的误导。此外,风玫瑰图在表示大范围或复杂地形的风场时可能存在一定的局限性。

总的来说,风玫瑰图是一种强大的数据可视化工具,可以帮助我们更好地理解和分析风的特征和趋势。它在气象学、地理学和环境科学等领域中的应用广泛,并具有重要的研究和决策价值。然而,我们在使用风玫瑰图时需要注意数据的准确性和采样频率,以确保图表的可靠性和有效性。

📣 代码

Documentation: Wind rose as a scatter plotTable of Contents Example 1: Individual sensors records on a single wind rose Example 2: Three-variate wind rose Example 1: Individual sensors records on a single wind rose Multiple sensors are consdiered. However, only 2 variables are represented. Here we show the wind direction and the mean wind speed for 4 different wind sensorsclearvars;close all;clc;Nsensors =4; % number of wind sensorsNsamples = 100; % number of samplesCOLOR = {'r','b','k','c','m','g'}; % color choice
% generation of recordsDir =[180,270,0,90]'*ones(1,Nsamples)+20.*randn(Nsensors,Nsamples); % #1 Mean wind directionU = abs(1.*randn(Nsensors,Nsamples)+ ones(Nsensors,1)*linspace(5,20,Nsamples)); %#2 Mean wind speedname_U = '$overline{u}$ (ms$^{-1}$)'; % #4 name of variable U% plot the wind rosejj=1;figurefor ii=1:Nsensors, h{ii} = ScatterWindRose(Dir(ii,:),U(ii,:),'labelY',name_U); set(h{ii},'Marker','o','markerfacecolor',... COLOR{ii},'markeredgecolor','k') hold on leg{jj} = ['sensor ',num2str(jj)]; jj=jj+1;endset(gcf,'color','w');legend([h{:}],leg,'location','NorthEastOutside');
% put axis and text on topth1 = findobj(gcf,'Type','text');th2 = findobj(gcf,'Type','line');for jj = 1:length(th1), uistack(th1(jj),'top');endfor jj = 1:length(th2), uistack(th2(jj),'top');end
% Adjust font size and nameset(findall(gcf,'-property','FontSize'),'FontSize',10,'fontName','Times')
Example 2: Three-variate wind rose
Three variables are used hereafter:The mean wind speed (Based on the 4 wind sensors from Example 1)The turbulence intensity (TI)The wind direction (Based on the 4 wind sensors from Example 1)% TI is defined as:TI =abs(0.05+abs(1./U)+0.03.*randn(size(U))); % #3 TI
% force column vectors: % we are not longer interested in identifying the sensorsDir = Dir(:);U=U(:);TI = TI(:)*100;
% We only want to look at TI lower than 30 %indTI = find(TI>30);U(indTI)=NaN;
% set limits and labelslimU = [min(U),max(U)]; % #3 limites for the wind speedname_U = '$overline{u}$ (ms$^{-1}$)'; % #4 name of variable Uname_IU = 'TI (%)'; % #4 name of variable IU
% plot the datafigure[h,c] = ScatterWindRose(Dir,U,'Ylim',limU,'labelY',name_U,'labelZ',name_IU,'Z',TI);% c is the colorbr handle% h is the scatter handle% put axis and text on topth1 = findobj(gcf,'Type','text');th2 = findobj(gcf,'Type','line');for jj = 1:length(th1) uistack(th1(jj),'top');endfor jj = 1:length(th2) uistack(th2(jj),'top');end
% Adjust the width of the colorbarx1=get(gca,'position');x=get(c,'Position');x(4)= c.Position(4)/3; % three times thinner than initiallyset(c,'Position',x)set(gca,'position',x1)
% Adjust font size and nameset(findall(gcf,'-property','FontSize'),'FontSize',10,'fontName','Times')

function [varargout] =ScatterWindRose(X,Y,varargin)%%% [varargout] =ScatterWindRose(X,Y,varargin) creates a scatter polar plot% with 2 to 3 variables as input%%% Input:% varargin: 1 to 6 inputs :% #1 Direction ; type: float ; size: [1 x N] in DEGREES% #2 variable associated to direction (ex: speed); type: float; size: [1 x N]% #3 limits associated to #2; type: float ; size [1x2] -> if empty variable '[]' is written, the [min(#2),max(#2)] is used% #4 name of variable #2; type: string;% #5 variable associated to #2 and #1; type: float; size: [1 x N]% #6 name of variable #5; type: string;%%% Syntax : % [hpol] =ScatterWindRose(Dir,U)% [hpol,c] =ScatterWindRose(Dir,U)%% OUTPUT% optionals: % varargout{1}: scatter handle% varargout{2}: colorbar handle% %% Author info% Author: E. Cheynet, UiB, Norway% Last modified: 2020-06-25
%% Input parser% Number of outputs must be >=3 and <=4.nargoutchk(0,2)% force columns vectorsX = X(:); Y=Y(:);X(X<0)=X(X<0)+360;
[cax,~,~] = axescheck(X);
% options: default valuesp = inputParser();p.CaseSensitive = false;p.addOptional('Z',[]);p.addOptional('Ylim',[min(Y),max(Y)]);p.addOptional('labelZ','');p.addOptional('labelY','');p.addOptional('myMarker','+');p.addOptional('myColor','k');% p.addOptional('plotType','scatter');p.parse(varargin{:});% shorthen the variables namelabelZ = p.Results.labelZ;labelY = p.Results.labelY;Z = p.Results.Z(:);myMarker = p.Results.myMarker;myColor = p.Results.myColor;Ylim = p.Results.Ylim;% plotType = p.Results.plotType;%% Check errorsif Ylim(1)>Ylim(2), warning('you have specified Ylim(1)>Ylim(2); The two limits are flipped so that Ylim(1)<Ylim(2).');elseif Ylim(1)==Ylim(2), error('you have specified Ylim(1)=Ylim(2). You need to choose Ylim(1)~=Ylim(2).');endif isnumeric(labelZ), error('labelZ must be a string');endif isnumeric(labelY), error('labelY must be a string');endif ischar(X) || ischar(Y) error('MATLAB:polar:InvalidInputType', 'Input arguments must be numeric.');endif ~isequal(size(X),size(Y)) error('MATLAB:polar:InvalidInput', 'X and Y must be the same size.');end%% Initialisation of figure% get hold state
cax = newplot(cax);if ~ishold(cax); % make a radial grid hold(cax,'on'); % Get limits Ymax = Ylim(2); Ymin = Ylim(1); % limits from Ymin to Ymax X = X(Y>= Ymin & Y<=Ymax); % limit from Zmin to Zmax, if variable Z is included if ~isempty(Z), Z = Z(Y>= Ymin & Y<=Ymax); end Y = Y(Y>= Ymin & Y<=Ymax); %% Create circles and radius % define a circle Ncirc = 4; createCircles(Ncirc,Ymax,Ymin,labelY) % create radius createRadius(Ymax,Ymin) % set view to 2-D view(cax,2); % set axis limits axis(cax,(Ymax-Ymin)*[-1 1 -1.15 1.15]); setappdata( cax, 'rMin', Ymin );else %Try to find the inner radius of the current axis. if (isappdata ( cax, 'rMin' ) ) Ymin = getappdata(cax, 'rMin' ); else Ymin = 0; endend%% --------------------------% PLOT the data% --------------------------% transform data to Cartesian coordinates.xx = (Y - Ymin).*cosd(90-X);yy = (Y - Ymin).*sind(90-X);% plot data on top of gridif ~isempty(Z), h = scatter(xx,yy,25,Z,'filled'); set(h,'MarkerEdgeColor','k') c =colorbar; set(c,'location','NorthOutside','TickLabelInterpreter','latex'); title(c,labelZ,'interpreter','latex')else h = plot(xx,yy,[myMarker,myColor]);endif nargout == 1 varargout{1} = h;elseif nargout == 2 varargout{1} = h; varargout{2} = c;end

set(cax,'dataaspectratio',[1 1 1]), axis(cax,'off');set(get(cax,'xlabel'),'visible','on')set(get(cax,'ylabel'),'visible','on')set(gcf,'color','w');uistack(h, 'bottom')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Nested functions%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function createCircles(Ncirc,Ymax,Ymin,labelY) theta = linspace(0,360,100); xunit = cosd(theta); yunit = sind(theta); cos_scale = cosd(-20); sin_scale = sind(-20); % draw radial circles for ii = 1:Ncirc if ii<Ncirc COLOR = [0.5,0.5,0.5]; else COLOR = [0.2 0.2 0.2]; end line(xunit*ii.*(Ymax-Ymin)./Ncirc,... yunit*ii.*(Ymax-Ymin)./Ncirc,'color',COLOR,... 'linestyle','-'); if ii >= Ncirc, text(ii.*(Ymax-Ymin)./Ncirc.*cos_scale,... ii.*(Ymax-Ymin)./Ncirc.*sin_scale, ... [' ',num2str((Ymin+ii.*(Ymax-Ymin)./Ncirc),2),' ',... ' ',... labelY],'verticalalignment','bottom','interpreter','latex'); else text(ii.*(Ymax-Ymin)./Ncirc.*cos_scale,... ii.*(Ymax-Ymin)./Ncirc.*sin_scale, ... [' ',num2str((Ymin+ii.*(Ymax-Ymin)./Ncirc),2)],... 'verticalalignment','bottom','interpreter','latex'); end end end function createRadius(Ymax,Ymin) % origin aligned with the NORTH thetaLabel = [[90,60,30],[360:-30:120]]; theta = 0:30:360; cs = [-cosd(theta); cosd(theta)]; sn = [-sind(theta); sind(theta)]; line((Ymax-Ymin)*cs,(Ymax-Ymin)*sn,'color',[0.5,0.5,0.5],... 'linestyle','-') % annotate spokes in degrees rt = 1.1*(Ymax-Ymin); for iAngle = 1:numel(thetaLabel), if theta(iAngle) ==0, text(rt*cosd(theta(iAngle)),rt*sind(theta(iAngle)),'E',... 'horizontalalignment','center'); elseif theta(iAngle) == 90, text(rt*cosd(theta(iAngle)),rt*sind(theta(iAngle)),'N',... 'horizontalalignment','center'); elseif theta(iAngle) == 180, text(rt*cosd(theta(iAngle)),rt*sind(theta(iAngle)),'W',... 'horizontalalignment','center'); elseif theta(iAngle) == 270, text(rt*cosd(theta(iAngle)),rt*sind(theta(iAngle)),'S',... 'horizontalalignment','center'); else text(rt*cosd(theta(iAngle)),rt*sind(theta(iAngle)),int2str(abs(thetaLabel(iAngle))),... 'horizontalalignment','center'); end end endend

⛳️ 运行结果

【免费】基于Matlab画风玫瑰图

🔗 参考文献

🎈 部分理论引用网络文献,若有侵权联系博主删除
🎁  关注我领取海量matlab电子书和数学建模资料

👇  私信完整代码和数据获取及论文数模仿真定制

1 各类智能优化算法改进及应用

生产调度、经济调度、装配线调度、充电优化、车间调度、发车优化、水库调度、三维装箱、物流选址、货位优化、公交排班优化、充电桩布局优化、车间布局优化、集装箱船配载优化、水泵组合优化、解医疗资源分配优化、设施布局优化、可视域基站和无人机选址优化

2 机器学习和深度学习方面

卷积神经网络(CNN)、LSTM、支持向量机(SVM)、最小二乘支持向量机(LSSVM)、极限学习机(ELM)、核极限学习机(KELM)、BP、RBF、宽度学习、DBN、RF、RBF、DELM、XGBOOST、TCN实现风电预测、光伏预测、电池寿命预测、辐射源识别、交通流预测、负荷预测、股价预测、PM2.5浓度预测、电池健康状态预测、水体光学参数反演、NLOS信号识别、地铁停车精准预测、变压器故障诊断

2.图像处理方面

图像识别、图像分割、图像检测、图像隐藏、图像配准、图像拼接、图像融合、图像增强、图像压缩感知

3 路径规划方面

旅行商问题(TSP)、车辆路径问题(VRP、MVRP、CVRP、VRPTW等)、无人机三维路径规划、无人机协同、无人机编队、机器人路径规划、栅格地图路径规划、多式联运运输问题、车辆协同无人机路径规划、天线线性阵列分布优化、车间布局优化

4 无人机应用方面

无人机路径规划、无人机控制、无人机编队、无人机协同、无人机任务分配、无人机安全通信轨迹在线优化

5 无线传感器定位及布局方面

传感器部署优化、通信协议优化、路由优化、目标定位优化、Dv-Hop定位优化、Leach协议优化、WSN覆盖优化、组播优化、RSSI定位优化

6 信号处理方面

信号识别、信号加密、信号去噪、信号增强、雷达信号处理、信号水印嵌入提取、肌电信号、脑电信号、信号配时优化

7 电力系统方面

微电网优化、无功优化、配电网重构、储能配置

8 元胞自动机方面

交通流 人群疏散 病毒扩散 晶体生长

9 雷达方面

卡尔曼滤波跟踪、航迹关联、航迹融合

 

Read More 

正文完
可以使用微信扫码关注公众号(ID:xzluomor)
post-qrcode
 0
评论(没有评论)

文心AIGC

2023 年 9 月
 123
45678910
11121314151617
18192021222324
252627282930  
文心AIGC
文心AIGC
人工智能ChatGPT,AIGC指利用人工智能技术来生成内容,其中包括文字、语音、代码、图像、视频、机器人动作等等。被认为是继PGC、UGC之后的新型内容创作方式。AIGC作为元宇宙的新方向,近几年迭代速度呈现指数级爆发,谷歌、Meta、百度等平台型巨头持续布局
文章搜索
热门文章
潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026

潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026

潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026 Jay 2025-12-22 09...
面向「空天具身智能」,北航团队提出星座规划新基准丨NeurIPS’25

面向「空天具身智能」,北航团队提出星座规划新基准丨NeurIPS’25

面向「空天具身智能」,北航团队提出星座规划新基准丨NeurIPS’25 鹭羽 2025-12-13 22:37...
商汤Seko2.0重磅发布,合作短剧登顶抖音AI短剧榜No.1

商汤Seko2.0重磅发布,合作短剧登顶抖音AI短剧榜No.1

商汤Seko2.0重磅发布,合作短剧登顶抖音AI短剧榜No.1 十三 2025-12-15 14:13:14 ...
跳过“逐字生成”!蚂蚁集团赵俊博:扩散模型让我们能直接修改Token | MEET2026

跳过“逐字生成”!蚂蚁集团赵俊博:扩散模型让我们能直接修改Token | MEET2026

跳过“逐字生成”!蚂蚁集团赵俊博:扩散模型让我们能直接修改Token | MEET2026 一水 2025-1...
10亿美元OpenAI股权兑换迪士尼版权!米老鼠救Sora来了

10亿美元OpenAI股权兑换迪士尼版权!米老鼠救Sora来了

10亿美元OpenAI股权兑换迪士尼版权!米老鼠救Sora来了 一水 2025-12-12 13:56:19 ...
最新评论
ufabet ufabet มีเกมให้เลือกเล่นมากมาย: เกมเดิมพันหลากหลาย ครบทุกค่ายดัง
tornado crypto mixer tornado crypto mixer Discover the power of privacy with TornadoCash! Learn how this decentralized mixer ensures your transactions remain confidential.
ดูบอลสด ดูบอลสด Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
Obrazy Sztuka Nowoczesna Obrazy Sztuka Nowoczesna Thank you for this wonderful contribution to the topic. Your ability to explain complex ideas simply is admirable.
ufabet ufabet Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
ufabet ufabet You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
ufabet ufabet Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
热评文章
跳过“逐字生成”!蚂蚁集团赵俊博:扩散模型让我们能直接修改Token | MEET2026

跳过“逐字生成”!蚂蚁集团赵俊博:扩散模型让我们能直接修改Token | MEET2026

跳过“逐字生成”!蚂蚁集团赵俊博:扩散模型让我们能直接修改Token | MEET2026 一水 2025-1...
10亿美元OpenAI股权兑换迪士尼版权!米老鼠救Sora来了

10亿美元OpenAI股权兑换迪士尼版权!米老鼠救Sora来了

10亿美元OpenAI股权兑换迪士尼版权!米老鼠救Sora来了 一水 2025-12-12 13:56:19 ...
IDC MarketScape: 容联云位居“中国AI赋能的联络中心”领导者类别

IDC MarketScape: 容联云位居“中国AI赋能的联络中心”领导者类别

IDC MarketScape: 容联云位居“中国AI赋能的联络中心”领导者类别 量子位的朋友们 2025-1...