本文介绍了在Matlab的polarPlot中内插端点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我设法像
data([1:end 1],1)
但是进行插值不会插值扩展路径
but doing interpolation does not interpolate the extended path
data = load('rem_angle_2.dat');
n = 30; phi = interp(data([1:end 1],1)*pi/180, n); H = interp(data([1:end 1], 3), n);
mu = 4 * 3.14e-7; ms = 1.2e6; K = 4.5e4; h = mu .* ms .* H / (2 .* K);
cosphi = h .* abs(cos( phi )) + (cos( phi ) ) .^2;
polar(phi, cosphi, 'r-x');
红色圆圈中的示例输出
数据
0 0.0314410000000000 0.940571096308908
15 0.0349230000000000 0.969954146597296
30 0.0313780000000000 0.839337718198396
45 0.0248700000000000 0.745214472624085
60 0.0231580000000000 0.478142525177060
75 0.0199550000000000 0.296548109978132
90 0.0270400000000000 0.155780680534267
105 0.0203080000000000 0.344801658689296
120 0.0254600000000000 0.592786274973634
135 0.0290010000000000 0.754378087574740
150 0.0238800000000000 0.834979038161321
165 0.0208110000000000 1.07503919352428
180 0.0312170000000000 0.950446840529786
210 0.0270380000000000 0.825443882649447
240 0.0321900000000000 0.588919403368673
270 0.0312300000000000 0.0490005355090298
300 0.0243250000000000 0.486928993377883
330 0.0257870000000000 0.846981230530059
如何在Matlab中内插端部?
推荐答案
如果要进行线性插值,应该研究函数interp1
.
The function interp1
is what you should look into, if you want to do linear interpolation.
n = 100;
phi = linspace(0, 2*pi, n);
H = interp1([data(:,1); 360+data(1,1)]*pi/180, ...
data([1:end 1],3), ...
phi);
请记住,极坐标中的线性插值与相应笛卡尔坐标中的线性插值有所不同! (请注意,对于大n
来说,绘图变得多大了.)
Bare in mind that linear interpolation in polar coordinates is something different than linear interpolation of the corresponding cartesian coordinates! (Notice how round the plot becomes for large n
.)
这篇关于在Matlab的polarPlot中内插端点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!