2012-12-12 26 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)去改變它。