How do you indicate a line between a user and a GPS satellite?

조회 수: 3 (최근 30일)
inhyeok
inhyeok 2025년 1월 23일
댓글: William Rose 2025년 2월 1일
The distance between the satellite and the user was obtained, but it was obtained with the ECEF coordinate system.
If you use ecef2enu, a function that changes the distance to the ENU coordinate system, errors continue to occur. I am curious about the solution, and furthermore, I want to use the unit vector to reduce the distance and then visualize the satellite-user distance.
receiverLat = 37.498759;
receiverLon = 127.027487;
receiverAlt = 0;
t = datetime('now', 'TimeZone', 'Local');
[satPos, ~] = gnssconstellation(t);
wgs84 = wgs84Ellipsoid('meters');
[recX, recY, recZ] = geodetic2ecef(wgs84, receiverLat, receiverLon, receiverAlt);
distances = zeros(size(satPos, 1), 1);
for i = 1:size(satPos, 1)
satX = satPos(i, 1);
satY = satPos(i, 2);
satZ = satPos(i, 3);
distances(i) = sqrt((satX - recX)^2 + (satY - recY)^2 + (satZ - recZ)^2);
end
disp('Satellite location:');
disp(satPos);
disp('Receiver location:');
disp([recX, recY, recZ]);
disp('Satellite-Receiver distances:');
disp(distances);

채택된 답변

William Rose
William Rose 2025년 1월 23일
Why do you think there are errors?
I modified your script slightly to display the receiver radius from Earth center, and the distance from receiver to the nearest and farthest satellites, and the difference between the nearest and farthest distances. One would expect the difference betwen nearest and farthest to be on the order of 2 Earth radii (~2 x 6.37e6 m). It is.
receiverLat = 37.498759;
receiverLon = 127.027487;
receiverAlt = 0;
t = datetime('now', 'TimeZone', 'Local');
[satPos, ~] = gnssconstellation(t);
wgs84 = wgs84Ellipsoid('meters');
[recX, recY, recZ] = geodetic2ecef(wgs84, receiverLat, receiverLon, receiverAlt);
distances = zeros(size(satPos, 1), 1);
for i = 1:size(satPos, 1)
satX = satPos(i, 1);
satY = satPos(i, 2);
satZ = satPos(i, 3);
distances(i) = sqrt((satX - recX)^2 + (satY - recY)^2 + (satZ - recZ)^2);
end
%disp('Satellite location:');
%disp(satPos);
fprintf('Receiver location: %.3e, %.3e, %.3e m.\n',recX,recY,recZ);
Receiver location: -3.051e+06, 4.045e+06, 3.861e+06 m.
fprintf('Receiver radius from center = %.3e m.\n',sqrt(recX^2+recY^2+recZ^2));
Receiver radius from center = 6.370e+06 m.
%disp('Satellite-Receiver distances:');
fprintf('Closest=%.2e, farthest=%.2e, difference=%.2e.\n',...
min(distances),max(distances),max(distances)-min(distances));
Closest=2.02e+07, farthest=3.27e+07, difference=1.25e+07.
  댓글 수: 5
inhyeok
inhyeok 2025년 2월 1일
thank you so much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Earth and Planetary Science에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by