![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1571742/image.png)
Crossing_points for LEO Satellite at the equator
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Neelanshu
2023년 12월 18일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Coordinate Transformations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!