在Matlab极坐标图中插值终点

时间:2015-04-09 20:16:03

标签: matlab plot interpolation

我设法连接普通polarPlot中的端点,如

data([1:end 1],1)

但是插值不会插入扩展路径

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'); 

红圈中的示例输出

enter image description here

数据

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中插入结束部分?

1 个答案:

答案 0 :(得分:1)

如果你想进行线性插值,你应该研究函数interp1

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有多圆。)