Plotting satellite elevation and azimuth using skyplot

26 visualizaciones (últimos 30 días)
Mathan
Mathan el 22 de Abr. de 2022
Comentada: Mathan el 22 de Abr. de 2022
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

Respuesta aceptada

Benjamin Thompson
Benjamin Thompson el 22 de Abr. de 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 comentarios
Benjamin Thompson
Benjamin Thompson el 22 de Abr. de 2022
Please mark the answer accepted if it works for you.
Mathan
Mathan el 22 de Abr. de 2022
Sorry I accepted your first answer believing we were discussing in the same thread. Just noticed that the second answer was a second comment and not a part of the first thread.
Thank you.

Iniciar sesión para comentar.

Más respuestas (1)

Benjamin Thompson
Benjamin Thompson el 22 de Abr. de 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.
  1 comentario
Mathan
Mathan el 22 de Abr. de 2022
Thank you. Well actually I do not want to show the propagation of satellites with time (like a movie or animation) but instead want to just put in the azimuth and elevations of individual satellites on the skyplot. I have already arranged the data such that each columns correspond to only one satellite - just want to put that '' individual column data'' into the skyplot. Doing so is actually creating the unique tracks for individual satellites but when I use the for loop (to display the tracks of individual satellites) it sort of is giving the plot for the last satellite and not for all satellites.
Is there any other way to do it without using a for loop?

Iniciar sesión para comentar.

Categorías

Más información sobre GNSS Positioning en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by