How to ensure that all values are not equal when using the ecef2enu function
이전 댓글 표시
I'm doing coordinate system transformation using the ecef2enu function. But for some reason, all three E, N, and U values are the same. I wonder why. How can I modify it to get the exact value?
Isn't it normal for the 1, 2, 3 matrices to have different values? Is there something wrong with my code?

currTime = gnss.SensorModel.InitialTime;
setup(scene)
wgs84 = wgs84Ellipsoid('meter');
while scene.IsRunning
[~,~,p,satPos,status] = gnss.read ();
allSatPos = gnssconstellation(currTime); % ecef
currTime = currTime + seconds(1/scene.UpdateRate);
[~,trueRecPos] = plat.read; % lla
trueRecPos_ecef = lla2ecef(trueRecPos); % uav ecef
[az,el] = lookangles(trueRecPos,satPos,gnss.SensorModel.MaskAngle);
nsat = length(satPos(:,1));
enu_sat = zeros(nsat,3);
for k = 1:1:nsat
enu_sat(k,:) = ecef2enu(satPos(k,1),satPos(k,2),satPos(k,3),trueRecPos(1),trueRecPos(2),trueRecPos(3),wgs84);
end
temp=1;
unit_sat = normalize(enu_sat,'norm',1);
target_z = 500;
scale_factors = target_z ./ unit_sat(:,3);
unit_sat_scaled = unit_sat .* scale_factors;
end
채택된 답변
추가 답변 (1개)
KALYAN ACHARJYA
2025년 3월 30일
편집: KALYAN ACHARJYA
2025년 3월 30일
As there may be multiple reasons, I don't have the complete data file and am unable to reproduce the issue. Please give it a try converting Earth-Centered Earth-Fixed (ECEF) coordinates to geodetic coordinates first might help.
trueRecPos_lla = ecef2lla(trueRecPos_ecef);
enu_sat(k,:) = ecef2enu(satPos(k,1), satPos(k,2), satPos(k,3), trueRecPos_lla(1), trueRecPos_lla(2), trueRecPos_lla(3), wgs84);
카테고리
도움말 센터 및 File Exchange에서 Guidance, Navigation, and Control에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!