惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
B
Blog
M
MIT News - Artificial intelligence
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Proofpoint News Feed
C
Check Point Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
博客园 - 叶小钗
S
SegmentFault 最新的问题
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
Microsoft Security Blog
Microsoft Security Blog
小众软件
小众软件
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
腾讯CDC
博客园 - Franky
博客园 - 聂微东
V
Visual Studio Blog
GbyAI
GbyAI
Martin Fowler
Martin Fowler
罗磊的独立博客
Y
Y Combinator Blog

博客园 - 朱小勇

Qt通信架构 C/C++导出库版本问题 高速互联常用概念 Anydoc使用 pyflow使用 两路 IQ 复数相除 minizip使用 解决Qt无法cdb调试问题 使用zadig-安装winusb驱动 libusb编译 word设置表和图的自动编号 DAC、AOC、AEC、ACC说明 技能包:qtwidget-instrument-control SKILL技能包学习 T参数 Python查看某个库版本并更新 C++通过pybind11与Python互调 数字信号处理-C++开源库 C++实现窗函数 C++-FFTW C++-Eigen SI-python工程参考 PAM4相关概念 win11共享文件夹 Qt使用QSplashScreen实现软件启动过渡界面 QGroundControl 建议尺寸 封窗知识 网分的触发学习 豆包生成图片去除水印
matlabe东向偏移、北向偏移、垂直偏移转经纬度
朱小勇 · 2025-10-13 · via 博客园 - 朱小勇

1.代码

function [target_lat, target_lon, target_alt] = relative2geodetic(ref_lat, ref_lon, ref_alt, east_offset, north_offset, up_offset)
% 将相对偏移转换为地理坐标系
% 输入:
%   ref_lat, ref_lon, ref_alt - 参考点的纬度、经度、高度(度, 度, 米)
%   east_offset, north_offset, up_offset - 东向、北向、垂直偏移量(米)
% 输出:
%   target_lat, target_lon, target_alt - 目标点的纬度、经度、高度

    % 地球参数(WGS84椭球体)
    a = 6378137.0;        % 地球长半轴(米)
    f = 1/298.257223563;  % 扁率
    e2 = 2*f - f*f;       % 第一偏心率平方
    
    % 将参考点经纬度转换为弧度
    lat_rad = deg2rad(ref_lat);
    lon_rad = deg2rad(ref_lon);
    
    % 计算子午圈曲率半径和卯酉圈曲率半径
    N = a / sqrt(1 - e2 * sin(lat_rad)^2);
    M = a * (1 - e2) / (1 - e2 * sin(lat_rad)^2)^(3/2);
    
    % 计算经纬度变化量
    dlat = rad2deg(north_offset / M);
    dlon = rad2deg(east_offset / (N * cos(lat_rad)));
    
    % 计算目标点坐标
    target_lat = ref_lat + dlat;
    target_lon = ref_lon + dlon;
    target_alt = ref_alt + up_offset;
end

2.测试

fprintf('=== 示例1:基本转换 ===\n');


% % 参考点坐标(北京天安门)
% ref_lat = 39.9087;    % 纬度(度)
% ref_lon = 116.3975;   % 经度(度)
% ref_alt = 50.0;       % 高度(米)
% 
% % 相对偏移量(米)
% east_offset = 1000;   % 东向偏移
% north_offset = 500;   % 北向偏移  
% up_offset = 10;       % 垂直偏移
% 
% % 转换为地理坐标
% [target_lat, target_lon, target_alt] = relative2geodetic(...
%     ref_lat, ref_lon, ref_alt, east_offset, north_offset, up_offset);
% 
% fprintf('参考点: (%.6f°N, %.6f°E, %.2fm)\n', ref_lat, ref_lon, ref_alt);
% fprintf('相对偏移: 东%.1fm, 北%.1fm, 上%.1fm\n', east_offset, north_offset, up_offset);
% fprintf('目标点: (%.6f°N, %.6f°E, %.2fm)\n\n', target_lat, target_lon, target_alt);


% 参考点坐标(北京天安门)
ref_lat = 0;    % 纬度(度)
ref_lon = 0;   % 经度(度)
ref_alt = 0;       % 高度(米)

% 相对偏移量(米)
east_offset = 1000;   % 东向偏移
north_offset = 1000;   % 北向偏移  
up_offset = 1000;       % 垂直偏移

% 转换为地理坐标
[target_lat, target_lon, target_alt] = relative2geodetic(...
    ref_lat, ref_lon, ref_alt, east_offset, north_offset, up_offset);

fprintf('参考点: (%.6f°N, %.6f°E, %.2fm)\n', ref_lat, ref_lon, ref_alt);
fprintf('相对偏移: 东%.1fm, 北%.1fm, 上%.1fm\n', east_offset, north_offset, up_offset);
fprintf('目标点: (%.6f°N, %.6f°E, %.2fm)\n\n', target_lat, target_lon, target_alt);