简介
站心坐标系,是以接收机位置作为zh,正北方向为方位角零度方向,天顶方向为仰角90°方向的坐标系。计算不同卫星相对于接收机位置的仰角与方位角,确定卫星在坐标系中的位置,即可绘制站心星空图。中心
读取文件
上图为不同编号卫星的仰角与方位角信息。首先读取文件:
绘制星空图
function hpol = skyPlot(az, el, prn, ss)
%% 准备坐标轴 ===========================================================
hAxis = newplot([]);
hold(hAxis, 'on');
%--- 绘制圆环 --------------------------------------------------------
rectangle('position', [-90, -90, 180, 180], ...'Curvature', [1 1], ...'facecolor', 'white', ...'edgecolor', 'k');
%--- 绘制辐条 ----------------------------------------------------
th = (1:6) * 2*pi / 12;
cst = cos(th); snt = sin(th);
cs = [cst; -cst];
sn = [snt; -snt];
line(90*sn, 90*cs, 'linestyle', ':', 'color', 'k', 'linewidth', 0.5, ...'handlevisibility', 'off');
rt = 1.1 * 90;
for i = 1:max(size(th))%--- 在绘图的右半部分标注方位角 -------------------------text(rt*snt(i), rt*cst(i), int2str(i*30), ...'horizontalalignment', 'center', 'handlevisibility', 'off');if i == max(size(th))loc = int2str(0);elseloc = int2str(180 + i*30);end%--- 在绘图的另一半标注方位角 ----------------------text(-rt*snt(i), -rt*cst(i), loc, ...'handlevisibility', 'off', 'horizontalalignment', 'center');
end%--- 绘制仰角网格 ----------------------------------------
th = 0 : pi/50 : 2*pi;
xunit = cos(th);
yunit = sin(th);
for elevation = 0 : 15 : 90elevationSpherical = 90*cos((pi/180) * elevation);line(yunit * elevationSpherical, xunit * elevationSpherical, ...'lineStyle', ':', 'color', 'k', 'linewidth', 0.5, ...'handlevisibility', 'off');text(0, elevationSpherical, num2str(elevation), ...'BackgroundColor', 'white', 'horizontalalignment','center', ...'handlevisibility', 'off');
end
%--- 切换为二维视角 ------------------------------------------------------
view(0, 90);
%--- 设定坐标轴范围 ------------------------------------------------------
axis([-95 95 -90 101]);
%% 将仰角转换为到中心的距离 ------
elSpherical = 90*cos(el * pi/180);
%--- 转换为笛卡尔坐标 ------------------------------
yy = elSpherical .* cos(az * pi/180);
xx = elSpherical .* sin(az * pi/180);
%% 在网格顶部绘制数据 ===========================================
hpol = plot(hAxis, xx', yy', '.-');
%--- 标注卫星最后位置 ------------------------------
plot(hAxis, xx(:,end)', yy(:,end)', 'o', 'MarkerSize', 7);%--- 标注卫星编号 -------------------
for i = 1:length(prn)if(prn(i) ~= 0)text(xx(i, end), yy(i, end), [' ',ss, int2str(prn(i))], 'color', 'b');end
end
%--- 设定xy轴具有相同的数据纵横比 ------------------
axis(hAxis, 'equal');
%--- 关闭笛卡尔坐标系坐标轴 -------------------------------
axis(hAxis, 'off');