matlab画一张极坐标图

1.画一张极坐标图

clear

clc

close all

% 生成随机风向和风速数据

num_samples = 100;

wind_directions = randi([0, 360], 1, num_samples)'; % 随机生成0到360度之间的风向

wind_speeds = randi([1, 10], 1, num_samples)'; % 随机生成1到10的风速

% 将风速和风向转换为极坐标坐标系的坐标

theta = deg2rad(wind_directions); % 将角度转换为弧度

rho = wind_speeds;

polaraxes; % 创建极坐标轴

polarplot(theta, rho, 'ro'); % 绘制风速和风向的极坐标图

title( 'Wind Speed and Direction Plot'); % 添加标题

pax=gca;

pax.ThetaDir = 'clockwise'; % 按顺时针方式递增

pax.ThetaZeroLocation = 'top'; % 按顺时针方式递增

pax.FontSize=12; %设置字体大小

pax.FontSizeMode='auto'; %设置字体自动化

2.画一张带有不同参数的极坐标图

clear

clc

close all

Un=zeros(100,1); %

Uw=zeros(100,1); % 西风为正

uz=zeros(100,1);

Un(:,1)=rand(100,1);

Uw(:,1)=rand(100,1);

Umean=sqrt(Un.^2+Uw.^2);

theta_deg = atan2d(Uw,Un)+180;

theta_deg =360-mod(theta_deg+180,360);

theta=theta_deg/360*2*pi;

arrayA=[theta,Umean];

tf1=find(arrayA(:,2)>0.9) %筛选出部分数据

arrayA1=arrayA(tf1,:);

tf2=arrayA(:,2)<0.9; %筛选出部分数据

arrayA2=arrayA(tf2,:);

% 开始画图

polaraxes

polarplot(arrayA1(:,1), arrayA1(:,2), 'ro'); % 绘制风速和风向的极坐标图

hold on

polarplot(arrayA2(:,1), arrayA2(:,2), 'bo');

hold off

%图的标签等

title( 'Wind Speed and Direction Plot'); % 添加标题

pax=gca;

pax.ThetaDir = 'clockwise'; % 按顺时针方式递增

pax.ThetaZeroLocation = 'top'; % 按顺时针方式递增

pax.FontSize=12; %设置字体大小

  • 7
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值