Plotting satellite elevation and azimuth using skyplot
24 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Benjamin Thompson
on 22 Apr 2022
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 Comments
More Answers (1)
Benjamin Thompson
on 22 Apr 2022
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.
See Also
Categories
Find more on GNSS Positioning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!