2012-12-12 24 views
2

我绘制了一些卫星的方位角和仰角,其中每个轨迹的颜色代表S4指数,从低(蓝色)到高(红色)的颜色。但是,我希望能够对颜色和相应的值进行格式化,以便实际区分闪烁的较低影响。这是因为闪烁的高端(红色)只显示一个或两个点。这里是轨迹和代码的图片。我怎样才能修改MATLAB的彩条

satellite trajectory showing color coded scintillation

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 
+3

一个简单的解决方案,如果是足以满足您的目的:尝试设置了'clim'(颜色限制)数据的您所关心的范围。如果你需要帮助,Google'matlab攀升'。 – tmpearce

回答

4

你可以使自己的colormap,它只是一个由3矩阵,其中列分别是红色,绿色和蓝色元件■。

的默认颜色映射为jet。如果您键入例如

>>> jet(16) 

你会得到一个16×3矩阵,你可以看到它是怎么回事。

然后使用colormap(your_own_colormap)去改变它。