我要用matlab画极坐标图,一共有12个点的数据
m0=0.1349 θ=0°
m1=0.1257 θ=30°
m2=0.1405 θ=60°
m3=0.1468 θ=90°
m4=0.1399 θ=120°
m5=0.1422 θ=150°
m6=0.1612 θ=180°
m7=0.1578 θ=210°
m8=0.1402 θ=240°
m9=0.1393 θ=270°
m10=0.1228 θ=300°
m11=0.1302 θ=330°
前面为数据值,后面是它在极坐标中的角度。
怎么用极坐标图画出来,然后用平滑的曲线连起来。
最好先把数据能归一化。
1.非封闭曲线,已归一化
clc
clear
t=0:pi/6:(2-1/6)*pi%初始化极角
m=[0.1349 0.1257 0.1405 0.1468 0.1399 0.1422 0.1612 0.1578 0.1402 0.1393 0.1228 0.1302];%初始化矢径
mm=mapminmax(m,0,1);%矢径数据归一化,归一化函数可以根据需求选取
polar(t,mm,'-');
2.封闭曲线,已归一化
clc
clear
t=0:pi/6:(2-1/6)*pi;%初始化极角
m=[0.1349 0.1257 0.1405 0.1468 0.1399 0.1422 0.1612 0.1578 0.1402 0.1393 0.1228 0.1302];%初始化矢径
mm=mapminmax(m,0,1);%矢径数据归一化,归一化函数可以根据需求选取
t=[t,t(1)];
mm=[mm,mm(1)];
polar(t,mm,'-');
这样可以了吗?
Basically, there are two ways to visualise the polar dataset provided above! I will start from the straightforward way in which the data is plotted in polar coordinates directly, to the alternative way in which the data is plotted in Cartesian coordinates instead.
- Firstly, you need to create two arrays which store the polar point consisting of theta and rho seperately, as follow:
theta = 0.0 : 30.0 : 330.0;- Plot line in polar coordinates
polarplot( deg2rad(theta), rho );- Plot line in Cartesian coordinates
[ x, y ] = pol2cart( deg2rad(theta), rho );Personally, the second plot is easier in visualisation but the transformation from polar coordinates to Cartesian ones must be made after the initialisation of variables.