Plotting satellite elevation and azimuth using skyplot
조회 수: 26 (최근 30일)
이전 댓글 표시
Hello,
I was trying to plot satellite elevations and azimuths (which are 210 x 3 matrices) using skyplot. I referred to https://se.mathworks.com/matlabcentral/answers/1610590-using-skyplot-and-hold-on and came up with the below code to get the output:
ele = load('elevation.mat');
elevation = ele.elevation;
azi = load('azimuth.mat');
azimuth = azi.azimuth;
g = [];
[row_prn, col_prn] = size(elevation);
for i=1:col_prn
g = [g ones(size(elevation(:,i))) + (i-1) ];
end
for i = 1:col_prn
skyplot(azimuth(:,i), elevation(:,i), GroupData=categorical(g(:,i)))
end
I am using a for loop in order to see the azimuth and elevation of different satellites together in the skyplot (each column in either elevation or azimuth corresponds to one particular satellite - since there are 3 columns that mean there are 3 different satellites).
However, I am only seeing the output for the last run of the 'for loop' and not for the entire loop. Any help to fix this? Attached are the .mat files.
Thanks
댓글 수: 0
채택된 답변
Benjamin Thompson
2022년 4월 22일
You have to make all data into a one dimensional vector, not a two dimensional matrix. One quick way is to use one colon instead of row/column indices:
ele = load('elevation.mat');
elevation = ele.elevation;
azi = load('azimuth.mat');
azimuth = azi.azimuth;
g = [];
[row_prn, col_prn] = size(elevation);
for i=1:col_prn
g = [g ones(size(elevation(:,i))) + (i-1) ];
end
skyplot(azimuth(:), elevation(:), GroupData=categorical(g(:)))
댓글 수: 3
추가 답변 (1개)
Benjamin Thompson
2022년 4월 22일
skyPlot is intended to show a snapshot of multiple satellites rather than a plot history. Type "doc skyplot" for details. Here is the example they suggest for animating a skyplot to show propagation of satellites over time:
for i = 1:numSimSteps
[~, ~, status] = gnss([0 0 0],[0 0 0]);
satAz = status.SatelliteAzimuth;
satEl = status.SatelliteElevation;
set(skyplotHandle,'AzimuthData',satAz,'ElevationData',satEl);
drawnow
end
So if you really wanted to show satellite positions for multiple time points in one plot you would need to combine all the azimuth and elevation data into a single vector of 630 entries instead of the 210x3 matrix. But then you cannot join points for single satellites together with a line to show unique tracks. Maybe the prn labeling or group labeling features would help there.
참고 항목
카테고리
Help Center 및 File Exchange에서 GNSS Positioning에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!