如何在八度图中以极坐标图绘制天线方向图?

时间:2019-12-10 12:06:14

标签: plot octave

我在Octave中的极坐标图有一些问题。特别是,我制作了一个脚本,该脚本结合了水平和垂直天线方向图,以获得天线的3D天线方向图,从而结果是360x360元素的矩阵。如果我通过surf function绘制矩阵,则可以获得该图像,但我想获得天线方向图。我该怎么做?

编辑:

theta3D = linspace(0, 2*pi - (2*pi/360), 360);
phi3D = linspace(0, 2*pi - (2*pi/360), 360);

%% from dBm to dB
maxGainVdB = mGVNnA - 30;
maxGainHdB = mGHNnA - 30;

%% from dB to Watt
maxGainVWatt = 10.^(maxGainVdB/10);
maxGainHWatt = 10.^(maxGainHdB/10);

%% normalization
maxGainVWattNorm = maxGainVWatt./max(maxGainVWatt);
maxGainHWattNorm = maxGainHWatt./max(maxGainHWatt);

%% Gv and Gh
Gv = 10*log10(maxGainVWattNorm);
Gh = 10*log10(maxGainHWattNorm);

%% weighting factors 
  % where "i" is theta and j is phi
for i = 1 : length(phi3D) 
  for j = 1 : length(theta3D)

    w1(i, j) = maxGainVWattNorm(i)*(1 - maxGainHWattNorm(j));
    w2(i, j) = maxGainVWattNorm(j)*(1 - maxGainHWattNorm(i));

  end
end

%% normalization-related parameter
k = 2; %% As indicated in Chapter 2

%% estimated G 

for i = 1 : length(phi3D) 
  for j = 1 : length(theta3D)

    estG(i, j) = ((Gh(i)*w1(i,j) + Gv(j)*w2(i,j))/((w1(i,j)^k + w2(i,j)^k))^(1/k));

  end
end

figure


[X, Y] = meshgrid (theta3D, phi3D);
surf(X,Y,estG)

数据

mGHNnA = [0.0762    0.0976  0.1207  0.146   0.1744  0.2066  0.2428  0.2827  0.3256  0.3705  0.4165  0.4631  0.5107  0.5602  0.6129  0.6704  0.7334  0.8021  0.8754  0.9518  1.0294  1.1067  1.1834  1.2608  1.3419  1.4318  1.5376  1.6653  1.8213  2.011   2.2382  2.5046  2.8096  3.1494  3.5171  3.8976  4.2687  4.6021  4.8717  5.0727  5.201   5.2687  5.2965  5.3066  5.3189  5.3365  5.3865  5.4558  5.5635  5.7028  5.8633  6.0489  6.2538  6.4708  6.6929  6.914   7.1293  7.3344  7.5209  7.6879  7.8455  7.9974  8.1362  8.2677  8.4072  8.547   8.6955  8.8539  9.025   9.21    9.4099  9.6251  9.8558  10.102  10.362  10.636  10.924  11.224  11.536  11.858  12.189  12.528  12.875  13.229  13.59   13.954  14.323  14.696  15.071  15.447  16.203  16.58   17.089  17.593  18.093  18.588  19.077  19.56   20.036  20.506  20.969  21.424  21.861  22.278  22.683  23.081  23.47   23.856  24.235  24.609  24.98   25.344  25.698  26.037  26.347  26.622  26.87   27.09   27.289  27.459  27.601  27.729  27.849  27.962  28.068  28.158  28.244  28.282  28.272  28.233  28.204  28.181  28.182  28.2    28.21   28.203  28.206  28.181  28.185  28.238  28.346  28.526  28.794  29.158  29.616  30.155  30.753  31.375  31.988  32.556  33.032  33.32   33.435  33.452  33.476  33.597  33.831  34.167  34.581  35.047  35.48   35.784  36.026  36.134  35.959  35.742  35.544  35.466  35.575  35.746  35.995  36.162  36.19   36.11   35.912  35.695  35.529  35.417  35.401  35.464  35.467  35.622  35.747  35.773  35.787  35.827  35.802  35.722  35.596  35.544  35.59   35.687  35.784  35.857  35.867  35.804  35.679  35.462  35.131  34.68   34.179  33.68   33.231  32.833  32.532  32.326  32.18   32.035  31.752  31.265  30.628  29.95   29.221  28.526  27.919  27.419  27.03   26.737  26.542  26.415  26.341  26.301  26.269  26.241  26.212  26.179  26.143  26.102  26.051  25.983  25.892  25.795  25.707  25.636  25.584  25.542  25.502  25.464  25.424  25.362  25.269  25.156  25.013  24.827  24.604  24.343  24.042  23.713  23.361  22.998  22.62   22.229  21.827  21.418  21.004  20.587  20.156  19.72   19.278  18.833  18.385  17.934  17.478  17.018  16.555  16.086  15.614  15.138  14.658  14.175  13.689  13.336  12.982  12.629  12.277  11.926  11.577  11.23   10.887  10.549  10.215  9.8873  9.5665  9.2535  8.9474  8.6508  8.3601  8.0783  7.8076  7.5485  7.2995  7.0654  6.8356  6.6223  6.418   6.2237  6.0401  5.8621  5.6946  5.5356  5.384   5.2382  5.0961  4.9558  4.8113  4.6579  4.5018  4.3427  4.182   4.022   3.8609  3.7051  3.5585  3.4213  3.2873  3.1583  3.032   2.9015  2.7555  2.6037  2.4462  2.284   2.1188  1.9533  1.7903  1.6325  1.4827  1.3435  1.209   1.0844  0.9762  0.8832  0.7952  0.7224  0.6616  0.609   0.5607  0.5128  0.4625  0.4103  0.3567  0.3033  0.2521  0.2051  0.164   0.1295  0.1013  0.0786  0.06    0.0442  0.0304  0.0182  0.0083  0.0019  0   0.0035  0.0125  0.0242  0.0388 0.0564]

mGVNnA = [ 1.7  1.1099  0.7069  0.4755  0.2901  0.1465  0.0475  0   0.0014  0.0449  0.1292  0.2868  0.4673  0.7364  1.2223  1.9732  3.0173  4.3603  5.9631  7.7179  9.5019  9.832   8.9113  8.2694  8.0057  8.1343  8.6399  9.5171  10.742  12.285  14.065  16.092  18.473  21.416  25.15   27.353  27.395  26.174  23.967  21.86   20.131  18.734  17.599  16.638  15.887  15.369  15.082  15.024  15.211  15.606  16.196  16.958  17.868  18.867  20  20.151  19.842  19.695  19.725  19.787  19.905  20.082  20.265  20.432  20.595  20.789  21.013  21.281  21.623  22.058  22.536  23.101  23.715  24.38   25.113  25.898  26.737  27.595  28.478  29.381  30.284  31.155  31.971  32.721  33.389  33.969  34.473  34.88   35.237  35.563  35.885  36.251  36.805  37.442  38.143  38.785  39.282  39.452  39.252  38.808  38.293  37.764  37.253  36.773  36.34   35.953  35.634  35.368  35.192  35.093  35.087  35.161  35.305  35.638  35.968  36.19   36.22   36.098  35.797  35.382  35.001  34.788  34.768  34.921  35.411  36.172  36.807  36.485  36.261  35.984  35.618  35.165  34.735  34.498  34.647  35.242  36.268  37.584  38.828  39.695  40.087  40.283  40.635  41.382  42.64   43.356  41.606  40.07   39.359  39.185  39.081  38.836  38.624  38.456  38.255  38.206  38.493  39.266  40.491  41.983  43.328  42.563  40.545  38.503  37.071  36.429  36.194  36.104  35.836  35.579  35.481  35.506  35.707  35.994  36.07   36.031  36.033  36.214  36.667  37.435  38.147  38.873  39.727  40.902  42.706  43.934  43.635  43.926  44.379  44.797  45.114  45.558  46.371  47.239  49.24   52.957  57.002  55.602  53.712  53.855  57.666  52.999  48.404  45.794  44.523  44.54   44.979  45.826  47.281  48.725  49.537  49.035  47.911  45.782  43.136  40.9    39.415  38.682  38.471  38.664  39.083  39.55   39.89   39.954  39.921  40.111  40.907  41.583  41.361  41.264  40.952  40.156  39.005  37.776  36.579  35.531  34.625  33.843  33.158  32.54   32.059  31.661  31.352  31.117  30.908  30.74   30.578  30.447  30.306  30.141  29.997  29.704  29.318  28.964  28.61   28.262  27.903  27.512  27.083  26.622  26.123  25.592  25.037  24.464  23.88   23.292  22.702  22.114  21.537  20.976  20.433  19.985  19.564  19.172  18.811  18.484  18.191  17.938  17.728  17.566  17.458  17.411  17.431  17.437  16.937  16.486  16.093  15.757  15.479  15.269  15.133  15.062  15.072  15.144  15.254  15.407  15.568  15.726  15.86   15.971  16.077  16.2    16.408  16.719  17.174  17.79   18.611  19.673  21.051  22.834  24.971  27.442  29.851  27.032  24.994  23.406  21.624  20.012  18.602  17.435  16.433  15.668  15.115  14.729  14.47   14.339  14.383  14.654  15.252  16.216  14.91   13.992  13.353  12.978  12.89   13.16   13.841  14.942  16.463  18.341  20.559  23.437  26.905  27.021  23.385  19.308  16.1    13.668  11.801  10.36   9.2831  8.5509  8.1662  8.1298  8.4381  7.8963  6.1559  4.6964  3.4785  2.4834 ] 

2 个答案:

答案 0 :(得分:1)

我不知道您期望哪种极坐标图,但是下面的代码可以帮助您举例说明。

  • 二维极坐标图
% polar plot for G vs. phi, when theta = pi
polar(phi3D, estG(:,length(theta3D)/2+1));
hold on;
% polar plot for G vs. theta, when phi = pi
polar(theta3D, estG(length(phi3D)/2+1,:));
legend("G vs. phi @(theta=pi)","G vs. theta @(phi=pi)");
title("2D radiation pattern");
hold off;

enter image description here -3D极地图

[X, Y] = meshgrid (theta3D, phi3D);
surf(X,Y,estG,'LineStyle','none');
xlabel("theta");
ylabel("phi");
zlabel("G");
colormap("jet");
colorbar

enter image description here

答案 1 :(得分:0)

所包含的代码确实会生成增益与theta和phi的估计值,但是,您将其绘制在直角坐标上。如果您在结果图中发现x和y轴的范围是0到2pi。 output from code in question

您创建了一个(θ,phi,幅值)数据集,并且需要将其转换为x,y,z数据集。

进行坐标转换,类似于:

xconv = estG.*sin(theta3D).*cos(phi3D);
yconv = estG.*sin(theta3D).*sin(phi3D);
zconv = estG.*cos(theta3D);

可以给您您所需要的。

surf(xconv,yconv,zconv,'Edgecolor','none')

产生:

output after simple coordinate transform

由于我不确定从该数据中得出什么输出是正确的,因此我无法确定它是否正确。我可能不知道网格和冲浪图数据可能存在一些排序问题。

我建议始终从简单开始。使用单位增益全向天线,看看上面的过程是否可以从两个圆图绘制到一个球体。然后生成更复杂的模式。

作为参考,这是一套不错的classroom exercises on 3D parametric plots