- Initialize the figure to plot all data in one graph.
- Define colors and line styles. Use 8 colors for groups of 8 satellites and use 4 different line styles (-, --, :, -.) to differentiate them.
- Loop through each hour (1-24). Extract the 6x3600 double matrix from “TC_NORM”{hour} and compute the time range (in seconds) for the current hour.
- Loop through all 32 satellites and assign row indices (modulo 6) to fetch data. Also, assign color and line style based on satellite index.
- Now plot the data and set appropriate plot styling.
GNSS Output Plotting Help.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have an output variable in cell array format (TC_NORM 24x1 cell). It is divided in 24 hours/day. It is divided in 3.600 seconds/hour. Total of 32 GPS Satellites.
For each hour the cell unity is 6 x 3.600 Double.
I have thought in formating the lines, four types to fit the 32 satellites with the eight colors for each satellite.
SV1(Line(*) Y); SV2(Line(*) M) SV3(Line(*) C) SV4(Line(*) R) SV5 (Line(*) G) SV6(Line(*) B) SV7 (Line(*) W) and SV8 (Line(*) K);
The second 8 satellite group the line (-);
The third 8 satellite group the line (.);
The forth 8 satellite group the line (+);
I wish to plot the entire TC_NORM 24x1 cell in only one figure.
Considering that sll satellites may appear in some hours and changing as hours increase. I will have a the Satellites on the Axis Y and the second of the entire day in the Axis X.
I appreciate and thank in advance any help I receive.
Best Regards,
Gilberto Fernandes
0 commentaires
Réponses (1)
sanidhyak
le 10 Mar 2025
I understand that you want to plot “GNSS” data from a “24x1 cell array” (“TC_NORM”), where each cell represents an hour with a “6x3600” double matrix. You also want to visualize all 32 GPS satellites over a 24-hour period with distinct colors and line styles.
Kindly refer to the following steps to achieve the same:
You can also go through the below code which implements the above approach:
clc; clear; close all;
% Assume TC_NORM is already loaded as a 24x1 cell array
colors = {'y', 'm', 'c', 'r', 'g', 'b', 'w', 'k'};
lineStyles = {'-', '--', ':', '-.'};
figure;
hold on;
total_seconds = 24 * 3600; % Total seconds in a day
yticks(1:32) = 1:32;
for hour = 1:24
if isempty(TC_NORM{hour})
continue;
end
data = TC_NORM{hour}; % 6 x 3600 matrix per hour
start_time = (hour - 1) * 3600; % Starting second for the hour
for sv = 1:32
row = mod(sv-1,6) + 1; % Select row in 6x3600 matrix
time_values = start_time + (1:3600);
color_index = mod(sv-1, 8) + 1;
line_index = floor((sv-1) / 8) + 1;
plot(time_values, data(row, :), 'Color', colors{color_index}, 'LineStyle', lineStyles{line_index});
end
end
ylabel('Satellite PRN');
xlabel('Time (seconds of the day)');
title('GNSS Output Plot');
ylim([1, 32]);
set(gca, 'YTick', 1:32);
grid on;
hold off;
For further reference on MATLAB’s plotting functions, kindly refer to:
Cheers & Happy Coding!
0 commentaires
Voir également
Catégories
En savoir plus sur Reference Applications dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!