Crossing_points for LEO Satellite at the equator

2 visualizzazioni (ultimi 30 giorni)
root
root il 7 Dic 2023
Risposto: nick il 18 Dic 2023
This code should give equatorial crossing points. Seems to work but not complete. This is sample sateltite latitude and I want to get the coresspodning equatorial crossing points.
Any comments on this code?
Thank you
latitude = [10, -5, -2, 8, -12, 15, 0, -3, 7, -9];
equatorial_crossing_indices = find(sign(latitude(1:end-1)) ~= sign(latitude(2:end))) + 1;
% Plotting
figure;
plot(latitude);
hold on;
scatter(equatorial_crossing_indices, latitude(equatorial_crossing_indices), 'red');
ax = gca;
ax.YAxisLocation = 'origin';
ax.XAxisLocation = 'origin';
ax.XAxis.TickLabelFormat = '%g°';
ax.YAxis.TickLabelFormat = '%g°';
plot([1, numel(latitude)], [0, 0], 'color', 'black', 'linestyle', '--', 'label', 'Equator');
title('Latitude Data with Equatorial Crossings');
xlabel('X');
ylabel('Latitude');
legend();
hold off;

Risposte (1)

nick
nick il 18 Dic 2023
Hi root,
I understand from your query that you are seeking assistance in detecting equatorial crossing points of latitude data, particularly in edge cases where transitions involve one of the latitudes being 0.
To detect the transitions in the sign of consecutive array elements in the “latitude” array, you can use an element-wise logical "AND" to check if one of the elements is 0 and then compute the "equatorial_crossing_indices" array using the "find" function. The following code snippet demonstrates how to handle such cases:
latitude = [10, -5, -2, 8, -12, 15, 0, -3, 7, -9];
%handling edge cases where there is 0
equatorial_crossing_indices = find((sign(latitude(1:end-1)) == -1* sign(latitude(2:end))) & sign(latitude(1:end-1)) ~= 0) + 1;
Here is the output observed for the given “latitude” array:
Hope this helps,
Regards,
Neelanshu

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by