Visualizing Satellite Skyplot Drawnow and Group Inconsistency.
Show older comments
I am developing a script that shows a sky plot of some satellites over a ground station. I am using drawnow and a for loop to make a video visualization of how the satellites az and el change with time. When satellites go below 0 degrees in azimuth, I want to change their color (I am using categorical groups for this). My script shows up differently if I run it in different ways. For instance, when I run it using a Live Script, the visualization only shows antenna positions moving when they all become part of the In View category, meaning there is a pause in movement before and after they all have elevations above 0 degrees. If I run the loop in the command line, the satellites move the entire time like they should BUT they do not retain their colors for their groups. Finally, if I run the Live Script, but pause execution and step through each iteration in the for loop, it works perfectly as intended, all satellites move continuously and the group colors are present. How can it be correct when parsing throught the for loop, but not correct when the full code is run?


<---This is from iterating line by line (it works!)
<--- These two frames are from running the Live Editor all the way through, these are updates directly after one another. You can see that the satellite furthest to the right did not update its position fluidly, it just jumped to its actual position when the 3rd satellite came into the picture. And immediately when the 3rd is in view, all of the satellites move and the colors change instead of changing color one by one.Here is the code.
[az, el, r, timeOut] = aer(gs(1), sat); % finds azimuth, elevation, range, and time between satellites and one
% ground station
skyplotHandle = skyplot(0, 0); % create skyplot for drawing
numSimSteps = (duration * 60 * 60) / sampleTime + 1; % steps in satellite scenario
for i = 1:numSimSteps
% here el(:,i) is a column vector with elevation angles of all satellites at time i
isOutOfView = false(size(el(:,i))); % assume everyone is in view
outOfViewIndex = find(el(:,i) < 0); % find elevation under 0 bc throws error in skyplot
el(outOfViewIndex,i) = 0; % set any elevations below 0 to 0
isOutOfView(outOfViewIndex) = true; % set boolean array to reflect out of view satellites
group = categorical(isOutOfView, [false true], ["Within View" "Outside View"]); % group together
ranges = string(round(r(:,i).*1e-3)); % convert to km, round for display, and define as string vector
ranges = append(ranges, " km"); % append for labeling
% set the data on the sky plot
set(skyplotHandle, 'AzimuthData', az(:,i), 'ElevationData', el(:,i), 'LabelData', ranges, GroupData=group);
drawnow % draw on figure
end
Answers (1)
Ryan Salvo
on 8 May 2026 at 15:12
Edited: Ryan Salvo
on 8 May 2026 at 18:14
0 votes
Quinnten, please try your code in R2026a. This was an issue with how skyplot handled data updates but should be resolved in R2026a.
Categories
Find more on CubeSat and Satellites 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!