필터 지우기
필터 지우기

Plotting satellite elevation and azimuth using skyplot

조회 수: 29 (최근 30일)
Mathan
Mathan 2022년 4월 22일
댓글: Mathan 2022년 4월 22일
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

채택된 답변

Benjamin Thompson
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
Benjamin Thompson
Benjamin Thompson 2022년 4월 22일
Please mark the answer accepted if it works for you.
Mathan
Mathan 2022년 4월 22일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Benjamin Thompson
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.
  댓글 수: 1
Mathan
Mathan 2022년 4월 22일
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?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 GNSS Positioning에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by