使用matlab/simulink将东北天坐标转化为北东地坐标

  1. 使用matlab代码

1.方法一(东北天转北东地)

% 定义东北天坐标系中的向量
x = 1;
y = 2;
z = 3;
% 定义转换矩阵
R = [0 1 0; 1 0 0; 0 0 -1];
% 进行转换
neu = [x, y, z];
ned = neu * R;
% 输出结果
disp('North-East-Down coordinates:');
disp(ned);

2.方法二(北东地转东北天)

% 假设你有一个NED坐标向量ned_vector = [North, East, Down]
ned_vector = [10, 20, -5];
% 定义旋转矩阵R,该矩阵将NED坐标系转换为ENU坐标系
R = [0 1 0; 1 0 0; 0 0 -1];
% 使用矩阵乘法运算将ned_vector转换为ENU坐标系下的坐标向量
enu_vector = R * ned_vector';
% 输出ENU坐标向量
disp(['ENU vector: [' num2str(enu_vector(1)) ', ' num2str(enu_vector(2)) ', ' num2str(enu_vector(3)) ']']);
  1. 使用simulink模块

  1. 创建一个simulink模型,添加一个Constant块,一个Matrix Concatenate块,一个Matlab Function块,一个To Workspace块,和一个Scope块。

  1. 将Constant块的值设置为你想要转换的NED坐标,例如[1 2 3]。

  1. 将Matrix Concatenate块的模式设置为“Concatenate along second dimension”,并将其输入连接到Constant块的输出。

  1. 将Matlab Function块的函数定义为以下代码:

function xENU = NED2ENU(xNED)
%NED2ENU Convert NED coordinates to ENU coordinates
%   xENU = NED2ENU(xNED) converts a1-by-3 vector of NED coordinates
%   (xNorth, yEast, zDown) to a 1-by-3vector of ENU coordinates
%   (xEast, yNorth, zUp).
% Perform the conversion using theformula
xENU = [xNED(2) xNED(1) -xNED(3)];
end
  1. 将Matlab Function块的输入连接到Matrix Concatenate块的输出,将其输出连接到To Workspace块和Scope块的输入。

  1. 运行模型,查看Scope块和Workspace中的结果。

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

CZU_zzjj

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值