2

我正在绘制一些卫星的方位角和仰角,其中每个轨迹的颜色代表 S4 指数,从低(蓝色)到高(红色)。但是,我希望能够格式化颜色和相应的值,以便实际上可以区分更多闪烁的较低影响。这是因为闪烁的高端(红色)只显示一两个点。这是轨迹和代码的图片。

显示颜色编码闪烁的卫星轨迹

clc; close all; clear all
load combo_323_full
circular_plot
x = [];
y = [];
for s = 1:samples       
  % plot each satellite location for that sample
  for sv = 1:sats
    % check if positive or negative elevation
    if (elevation((s - 1) * sats + sv) < 0)
      elNeg = 1;
    else
      elNeg = 0;
    end
    % convert to plottable cartesian coordinates
    el = elevation((s - 1) * sats + sv);
    az = azimuth((s - 1) * sats + sv);
    x = [x;(pi/2-abs(el))/(pi/2).*cos(az-pi/2)];
    y = [y;-1*(pi/2-abs(el))/(pi/2).*sin(az-pi/2)];
    % check for final sample
%     if (s == samples)
%       plot(x,y,'r*');
%       text(x,y+.07,int2str(SVs(sv)), ...
%            'horizontalalignment', ...
%            'center','color','r');
%     else
      % check for +/- elevation
%       if (elNeg == 0)
%         plot(x,y,'.','color',rgb('DarkBlue'));
%       else
%         plot(x,y,'g.');
% %       end
%     end
  end
end
z = combo(:,5);
for j = 1:10
%     hold on
%     circular_plot
lRef = length(x);
l1 = floor(lRef*(1/100));
l2 = floor(l1*j);
x_time = x(1:l2);
y_time = y(1:l2);
zr = z(1:l2);

navConstants;

% find out from 'plotMat' if plotting satellite locations or trajectories in
% addition determine how many satellites are being tracked and how many
% samples for each satellite (# samples / satellite must always be equal)
gpsTime = combo(1,2);
i = 1;
t = gpsTime;
while ((i ~= size(combo,1)) & (t == gpsTime))
  i = i + 1;
  t = combo(i,2);
end
if (t == gpsTime)
  sats = i;
else
  sats = i - 1;
end;
samples = size(combo,1) / sats;
SVs = combo(1:sats,1);
elevation = combo(:,20).*pi/180;
azimuth = combo(:,19).*pi/180;
% initialize polar - plotting area
figure(j);
axis([-1.4 1.4 -1.1 1.1]);
axis('off');
axis(axis);
hold on;
% plot circular axis and labels
th = 0:pi/50:2*pi;
x_c = [ cos(th) .67.*cos(th) .33.*cos(th) ];
y_c = [ sin(th) .67.*sin(th) .33.*sin(th) ];
plot(x_c,y_c,'color','w');
text(1.1,0,'90','horizontalalignment','center');
text(0,1.1,'0','horizontalalignment','center');
text(-1.1,0,'270','horizontalalignment','center');
text(0,-1.1,'180','horizontalalignment','center'); 
% plot spoke axis and labels
th = (1:6)*2*pi/12;
x_c = [ -cos(th); cos(th) ];
y_c = [ -sin(th); sin(th) ];
plot(x_c,y_c,'color','w');
text(-.46,.93,'0','horizontalalignment','center');
text(-.30,.66,'30','horizontalalignment','center');
text(-.13,.36,'60','horizontalalignment','center');
text(.04,.07,'90','horizontalalignment','center');

scatter(x_time,y_time,3,zr)
colorbar
axis equal
end
4

1 回答 1

4

您可以制作自己的颜色图,它只是一个 N x 3 矩阵,其中的列分别是红色、绿色和蓝色分量。

默认颜色图是jet. 例如,如果您键入

>>> jet(16)

你会得到一个 16 x 3 的矩阵,你可以看到它是如何制作的。

然后用colormap(your_own_colormap)它来改变它。

于 2012-12-12T03:16:56.130 回答