![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1571742/image.png)
Crossing_points for LEO Satellite at the equator
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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;
0 Kommentare
Antworten (1)
Neelanshu
am 18 Dez. 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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1571742/image.png)
Hope this helps,
Regards,
Neelanshu
0 Kommentare
Siehe auch
Kategorien
Mehr zu Coordinate Transformations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!