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!