blog
•
2026年9月22日
•
60 次阅读
飞动轴系转换推导作业MATLAB推算对比结果
tech
计算机
仿真
matlab
---
title: FeiDong.m:机体↔航迹 L_bk 双路线推导
date: 2026-09-22
tags: [飞行力学, MATLAB, 坐标变换]
---
# FeiDong.m:机体↔航迹 L_bk 双路线推导

关键在于分解步骤,轴系转动的时候一个轴一个轴来更好理解,航迹轴->(μ)风轴->(α、β)机体轴
## 源代码 FeiDong.m
```matlab
clc; clear;
syms chi gamma psi theta Phi real
syms alpha beta mu real
syms V real
Lx = @(a) [1 0 0; 0 cos(a) sin(a); 0 -sin(a) cos(a)];
Ly = @(a) [cos(a) 0 -sin(a); 0 1 0; sin(a) 0 cos(a)];
Lz = @(a) [cos(a) sin(a) 0; -sin(a) cos(a) 0; 0 0 1];
L_gk = Ly(gamma)*Lz(chi);
L_gb = Ly(theta)*Lx(Phi)*Lz(psi);
L_bk_A = simplify(L_gb.' * L_gk);
L_bw = Ly(alpha)*Lz(-beta);
L_wk = Lx(mu);
L_bk_B = simplify(L_bw*L_wk);
disp('=== L_bk(路线A:χ,γ,ψ,θ,Φ)==='); disp(L_bk_A)
disp('=== L_bk(路线B:α,β,μ)==='); disp(L_bk_B)
disp('--- 检查1:L_bk_A * L_bk_A'' - I ---');
disp(simplify(L_bk_A*L_bk_A.' - eye(3)))
disp('--- det(L_bk_A) ---'); disp(simplify(det(L_bk_A)))
disp('--- det(L_bk_B) ---'); disp(simplify(det(L_bk_B)))
v_b = simplify(L_bk_B*[V;0;0]);
disp('--- 检查2:v_k=[V;0;0] 时 v_b(应为 Vcosαcosβ, Vsinβ, Vsinαcosβ)---');
disp(v_b)
ang_A = [30 5 20 4 10];
A = double(subs(L_bk_A, {chi,gamma,psi,theta,Phi}, deg2rad(ang_A)));
disp('--- 检查3a:det(A)、正交误差(应 =1 / 0)---');
disp(['det(A) = ', num2str(det(A)), ' 正交误差 = ', num2str(norm(A*A.'-eye(3)))]);
v_b = A*[1;0;0];
beta0 = asin(v_b(2));
alpha0 = atan2(v_b(3), v_b(1));
Lbw_r = Ly(alpha0)*Lz(-beta0);
R = Lbw_r.'*A;
mu0 = atan2(R(2,3), R(2,2));
B = Lbw_r*Lx(mu0);
disp('--- 检查3b:反解结果(度数)---');
disp(['alpha = ', num2str(rad2deg(alpha0)), ...
' beta = ', num2str(rad2deg(beta0)), ...
' mu = ', num2str(rad2deg(mu0))]);
disp(['两条路线矩阵最大偏差 = ', num2str(max(abs(A(:)-B(:))))]);
L_special = simplify(subs(L_bk_B, {alpha,beta,mu}, {0,0,0}));
disp('--- 检查4:α=β=μ=0 时 L_bk_B(应为单位阵)---'); disp(L_special)
```
## 运行输出
```text
=== L_bk(路线A:χ,γ,ψ,θ,Φ)===
[cos(chi)*cos(gamma)*(cos(psi)*cos(theta) - sin(Phi)*sin(psi)*sin(theta)) + cos(chi)*sin(gamma)*(cos(psi)*sin(theta) + sin(Phi)*cos(theta)*sin(psi)) + cos(Phi)*sin(chi)*sin(psi), cos(gamma)*sin(chi)*(cos(psi)*cos(theta) - sin(Phi)*sin(psi)*sin(theta)) + sin(chi)*sin(gamma)*(cos(psi)*sin(theta) + sin(Phi)*cos(theta)*sin(psi)) - cos(Phi)*cos(chi)*sin(psi), cos(gamma)*(cos(psi)*sin(theta) + sin(Phi)*cos(theta)*sin(psi)) - sin(gamma)*(cos(psi)*cos(theta) - sin(Phi)*sin(psi)*sin(theta))]
[cos(chi)*cos(gamma)*(cos(theta)*sin(psi) + sin(Phi)*cos(psi)*sin(theta)) + cos(chi)*sin(gamma)*(sin(psi)*sin(theta) - sin(Phi)*cos(psi)*cos(theta)) - cos(Phi)*cos(psi)*sin(chi), cos(gamma)*sin(chi)*(cos(theta)*sin(psi) + sin(Phi)*cos(psi)*sin(theta)) + sin(chi)*sin(gamma)*(sin(psi)*sin(theta) - sin(Phi)*cos(psi)*cos(theta)) + cos(Phi)*cos(chi)*cos(psi), cos(gamma)*(sin(psi)*sin(theta) - sin(Phi)*cos(psi)*cos(theta)) - sin(gamma)*(cos(theta)*sin(psi) + sin(Phi)*cos(psi)*sin(theta))]
[ cos(Phi)*cos(chi)*cos(theta)*sin(gamma) - cos(Phi)*cos(chi)*cos(gamma)*sin(theta) - sin(Phi)*sin(chi), sin(Phi)*cos(chi) - cos(Phi)*cos(gamma)*sin(chi)*sin(theta) + cos(Phi)*sin(chi)*cos(theta)*sin(gamma), cos(Phi)*cos(gamma - theta)]
=== L_bk(路线B:α,β,μ)===
[cos(alpha)*cos(beta), sin(alpha)*sin(mu) - cos(alpha)*cos(mu)*sin(beta), - cos(mu)*sin(alpha) - cos(alpha)*sin(beta)*sin(mu)]
[ sin(beta), cos(beta)*cos(mu), cos(beta)*sin(mu)]
[cos(beta)*sin(alpha), - cos(alpha)*sin(mu) - cos(mu)*sin(alpha)*sin(beta), cos(alpha)*cos(mu) - sin(alpha)*sin(beta)*sin(mu)]
--- 检查1:L_bk_A * L_bk_A' - I ---
[ (cos(chi)*cos(gamma)*(cos(psi)*cos(theta) - sin(Phi)*sin(psi)*sin(theta)) + cos(chi)*sin(gamma)*(cos(psi)*sin(theta) + sin(Phi)*cos(theta)*sin(psi)) + cos(Phi)*sin(chi)*sin(psi))^2 + (cos(gamma)*sin(chi)*(cos(psi)*cos(theta) - sin(Phi)*sin(psi)*sin(theta)) + sin(chi)*sin(gamma)*(cos(psi)*sin(theta) + sin(Phi)*cos(theta)*sin(psi)) - cos(Phi)*cos(chi)*sin(psi))^2 + (cos(gamma)*(cos(psi)*sin(theta) + sin(Phi)*cos(theta)*sin(psi)) - sin(gamma)*(cos(psi)*cos(theta) - sin(Phi)*sin(psi)*sin(theta)))^2 - 1, (cos(gamma)*sin(chi)*(cos(theta)*sin(psi) + sin(Phi)*cos(psi)*sin(theta)) + sin(chi)*sin(gamma)*(sin(psi)*sin(theta) - sin(Phi)*cos(psi)*cos(theta)) + cos(Phi)*cos(chi)*cos(psi))*(cos(gamma)*sin(chi)*(cos(psi)*cos(theta) - sin(Phi)*sin(psi)*sin(theta)) + sin(chi)*sin(gamma)*(cos(psi)*sin(theta) + sin(Phi)*cos(theta)*sin(psi)) - cos(Phi)*cos(chi)*sin(psi)) + (cos(gamma)*(cos(psi)*sin(theta) + sin(Phi)*cos(theta)*sin(psi)) - sin(gamma)*(cos(psi)*cos(theta) - sin(Phi)*sin(psi)*sin(theta)))*(cos(gamma)*(sin(psi)*sin(theta) - sin(Phi)*cos(psi)*cos(theta)) - sin(gamma)*(cos(theta)*sin(psi) + sin(Phi)*cos(psi)*sin(theta))) + (cos(chi)*cos(gamma)*(cos(theta)*sin(psi) + sin(Phi)*cos(psi)*sin(theta)) + cos(chi)*sin(gamma)*(sin(psi)*sin(theta) - sin(Phi)*cos(psi)*cos(theta)) - cos(Phi)*cos(psi)*sin(chi))*(cos(chi)*cos(gamma)*(cos(psi)*cos(theta) - sin(Phi)*sin(psi)*sin(theta)) + cos(chi)*sin(gamma)*(cos(psi)*sin(theta) + sin(Phi)*cos(theta)*sin(psi)) + cos(Phi)*sin(chi)*sin(psi)), 0]
[(cos(gamma)*sin(chi)*(cos(theta)*sin(psi) + sin(Phi)*cos(psi)*sin(theta)) + sin(chi)*sin(gamma)*(sin(psi)*sin(theta) - sin(Phi)*cos(psi)*cos(theta)) + cos(Phi)*cos(chi)*cos(psi))*(cos(gamma)*sin(chi)*(cos(psi)*cos(theta) - sin(Phi)*sin(psi)*sin(theta)) + sin(chi)*sin(gamma)*(cos(psi)*sin(theta) + sin(Phi)*cos(theta)*sin(psi)) - cos(Phi)*cos(chi)*sin(psi)) + (cos(gamma)*(cos(psi)*sin(theta) + sin(Phi)*cos(theta)*sin(psi)) - sin(gamma)*(cos(psi)*cos(theta) - sin(Phi)*sin(psi)*sin(theta)))*(cos(gamma)*(sin(psi)*sin(theta) - sin(Phi)*cos(psi)*cos(theta)) - sin(gamma)*(cos(theta)*sin(psi) + sin(Phi)*cos(psi)*sin(theta))) + (cos(chi)*cos(gamma)*(cos(theta)*sin(psi) + sin(Phi)*cos(psi)*sin(theta)) + cos(chi)*sin(gamma)*(sin(psi)*sin(theta) - sin(Phi)*cos(psi)*cos(theta)) - cos(Phi)*cos(psi)*sin(chi))*(cos(chi)*cos(gamma)*(cos(psi)*cos(theta) - sin(Phi)*sin(psi)*sin(theta)) + cos(chi)*sin(gamma)*(cos(psi)*sin(theta) + sin(Phi)*cos(theta)*sin(psi)) + cos(Phi)*sin(chi)*sin(psi)), (cos(chi)*cos(gamma)*(cos(theta)*sin(psi) + sin(Phi)*cos(psi)*sin(theta)) + cos(chi)*sin(gamma)*(sin(psi)*sin(theta) - sin(Phi)*cos(psi)*cos(theta)) - cos(Phi)*cos(psi)*sin(chi))^2 + (cos(gamma)*sin(chi)*(cos(theta)*sin(psi) + sin(Phi)*cos(psi)*sin(theta)) + sin(chi)*sin(gamma)*(sin(psi)*sin(theta) - sin(Phi)*cos(psi)*cos(theta)) + cos(Phi)*cos(chi)*cos(psi))^2 + (cos(gamma)*(sin(psi)*sin(theta) - sin(Phi)*cos(psi)*cos(theta)) - sin(gamma)*(cos(theta)*sin(psi) + sin(Phi)*cos(psi)*sin(theta)))^2 - 1, 0]
[ 0, 0, 0]
--- det(L_bk_A) ---
1
--- det(L_bk_B) ---
1
--- 检查2:v_k=[V;0;0] 时 v_b(应为 Vcosαcosβ, Vsinβ, Vsinαcosβ)---
V*cos(alpha)*cos(beta)
V*sin(beta)
V*cos(beta)*sin(alpha)
--- 检查3a:det(A)、正交误差(应 =1 / 0)---
det(A) = 1 正交误差 = 1.1105e-16
--- 检查3b:反解结果(度数)---
alpha = -4.1857 beta = -9.7309 mu = -9.8802
两条路线矩阵最大偏差 = 1.1102e-16
--- 检查4:α=β=μ=0 时 L_bk_B(应为单位阵)---
[1, 0, 0]
[0, 1, 0]
[0, 0, 1]
```
