关于 matlab-compute-aerospace-environment
这是一个使用 Aerospace Toolbox 计算航空航天环境参数的 MATLAB 技能,涵盖大气、重力、风、磁场、大地水准面、空间天气、星历和地球定向。面向航空航天器分析,并提供函数选择与调用指导。
主要功能
- 01大气模型与气压高度计算
- 02行星重力与风场计算
- 03磁场与大地水准面计算
- 04空间天气与太阳活动指数
- 05行星星历与地球定向参数
适用场景
- 01估算不同高度的温度、压力和密度
- 02为飞行器建模重力与风场
- 03获取导航所需的磁场数据
- 04计算行星位置和地球定向参数
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ matlab/ matlab-agentic-toolkit --skill matlab-compute-aerospace-environment安装后在 Claude Code 中输入/matlab-compute-aerospace-environment确认已加载。
附带文件manifest.yaml
详细介绍
计算航空航天环境
使用 Aerospace Toolbox 函数计算航空航天飞行器分析所需的环境属性:大气、重力、风、磁场、大地水准面、空间天气、行星星历和地球定向。
适用场景
- 计算大气属性(温度、压力、密度、声速)
- 计算任意行星的重力矢量或加速度
- 对不同高度的水平风进行建模
- 获取用于导航或罗盘校正的磁场分量
- 计算大地水准面高度或地心半径
- 读取 NRLMSISE-00 输入所需的空间天气数据
- 计算行星或月球的位置(星历)
- 获取地球定向参数(极移、章动、UT1-UTC、CIP)
- 提及以下任意内容的提示词:大气模型、ISA、COESA、NRLMSISE、压力、温度、密度、声速、重力模型、WGS84、风模型、HWM、磁场模型、WMM、IGRF、大地水准面、空间天气、太阳通量、F10.7、Ap 指数、行星星历、月球位置、地球章动、极移、UT1、IERS
不适用场景
- 坐标系转换或旋转——使用
matlab-convert-aerospace-coordinates - 轨道力学或轨迹传播(星历用于获取位置,而非轨道传播)
- 气动系数计算
- Simulink 环境模型模块——使用 Aerospace Blockset
工作流
- 确定所需量——使用下方的决策表
- 调用函数——遵循此技能中的用法模式,确保语法正确
- 验证结果——检查单位和数值大小是否符合物理实际
决策表
| 需求 | 函数 | 关键输入 |
|---|---|---|
| 标准大气(快速) | atmosisa | 高度(m) |
| 1976 COESA 大气 | atmoscoesa | 高度(m) |
| NRLMSISE-00(详细高层大气) | atmosnrlmsise00 | alt、lat、lon、year、day、UTsec |
| 非标准大气(MIL-STD) | atmosnonstd | alt + 位置字符串参数 |
| CIRA 1986 参考大气 | atmoscira | lat、ctype、coord、month |
| 温度递减率大气(自定义) | atmoslapse | 高度(m)+ 9 个物理参数 |
| 气压高度 | atmospalt | 压力(Pa) |
| 水平风(HWM07/14) | atmoshwm | lat、lon、alt + 名称-值参数 |
| 球谐重力(任意行星) | gravitysphericalharmonic | PCPF [x,y,z](m) |
| WGS84 重力(地球、大地坐标) | gravitywgs84 | h、lat(+ lon、method、flags) |
| 带谐重力(任意行星) | gravityzonal | PCPF [x,y,z](m) |
| 离心加速度 | gravitycentrifugal | PCPF [x,y,z](m) |
| WMM 磁场 | wrldmagm | height(m)、lat、lon、decimalYear |
| IGRF 磁场 | igrfmagm | height(m)、lat、lon、decimalYear、generation |
| 大地水准面高度(起伏) | geoidheight | lat、lon |
| 地心半径 | geocradius | 地心纬度(deg) |
| 读取空间天气 CSV | aeroReadSpaceWeatherData | CSV 文件路径 |
| 提取太阳通量 / Ap 指数 | fluxSolarAndGeomagnetic | datetime 或 [year,day,UTCsec]、MAT 文件 |
| 行星 / 月球位置和速度 | planetEphemeris | Julian date、中心天体、目标天体 |
| 地球章动角 | earthNutation | Julian date |
| 月球天平动角 | moonLibration | Julian date |
| 地球极移 | polarMotion | UTC(Julian date) |
| 天球中间极调整 | deltaCIP | UTC(Julian date) |
| UT1 与 UTC 之差 | deltaUT1 | UTC(Julian date) |
| 读取 IERS 地球定向数据 | aeroReadIERSData | 文件夹路径 |
用法模式
标准大气和 COESA 大气
% International Standard Atmosphere
[T, a, P, rho] = atmosisa(1000);
% 1976 COESA (valid 0-1000 km)
[T, a, P, rho] = atmoscoesa(1000);
气压高度(atmospalt)
使用国际标准大气将压力(Pa)转换为高度(m)。
% Pressure altitude at standard sea-level pressure
alt = atmospalt(101325); % returns 0 m
% Pressure altitude at multiple pressures
alt = atmospalt([101325, 79501, 54048, 26500]);
% Typical use: convert measured pressure to altitude
measuredPressure_Pa = 75000;
pressureAltitude_m = atmospalt(measuredPressure_Pa);
输入:压力,单位为 帕斯卡。输出:基于 1976 COESA 的几何高度,单位为 米。
非标准大气(atmosnonstd)
使用位置字符串参数,而非名称-值对。
剖面类型(单个高度极值):
[T, a, P, rho] = atmosnonstd(height, 'Profile', extremeParam, frequency, extremeAltitude)
包络类型(高度范围极值——不需要 extremeAltitude 参数):
[T, a, P, rho] = atmosnonstd(height, 'Envelope', extremeParam, frequency)
可选的末尾参数:action('Warning'|'Error'|'None')、specification('310'|'210c')。
% Profile: high density, 1% of time, at 5 km altitude (extremeAltitude is NUMERIC)
[T, a, P, rho] = atmosnonstd(5000, 'Profile', 'High density', '1%', 5);
% Envelope: high pressure, 20% of time, MIL-STD-210C
[T, a, P, rho] = atmosnonstd([1000; 11000; 20000], 'Envelope', ...
'High pressure', '20%', 'None', '210c');
有效的 extremeParam:'High temperature'、'Low temperature'、'High density'、'Low density'、'High pressure'、'Low pressure'
有效的 frequency:'Extreme values'、'1%'、'5%'、'10%'、'20%'
有效的 extremeAltitude(仅限剖面类型,数值):5、10、20、30、40
CIRA 1986 模型
% By geopotential height, monthly mean, October
[T, P, zonalWind] = atmoscira(45, 'GPHeight', 20000, 'Monthly', 10);
% By pressure level
[T, alt, zonalWind] = atmoscira(45, 'Pressure', 101300, 'Monthly', 1);
参数:(latitude, ctype, coord, mtype, month),其中 ctype 为 'Pressure' 或 'GPHeight'。
NRLMSISE-00
% Basic call (uses default flux values)
[T, rho] = atmosnrlmsise00(altitude, latitude, longitude, year, dayOfYear, UTseconds);
% With flux data and no anomalous oxygen
[T, rho] = atmosnrlmsise00(altitude, lat, lon, year, dayOfYear, UTsec, ...
f107Average, f107Daily, magneticIndex, 'NoOxygen');
输出:T 为 N×2 矩阵 [外逸层温度、局部温度]。rho 为 N×9 矩阵(密度)。
温度递减率大气(atmoslapse)
需要 10 个位置参数,不只是高度。必须明确指定所有物理参数。
% TEMPLATE — not executable (shows calling convention)
[T, a, P, rho] = atmoslapse(altitude, g, gamma, R, lapseRate, ...
heightTroposphere, heightTropopause, density0, pressure0, temperature0);
% Example: ISA conditions
[T, a, P, rho] = atmoslapse([0 5000 11000 20000], ...
9.80665, 1.4, 287.0531, 0.0065, 11000, 20000, 1.225, 101325, 288.15);
参数:(height, g, heatRatio, gasConstant, lapseRate, hTroposphere, hTropopause, rho0, P0, T0)。适用于自定义行星大气或非标准海平面条件。
水平风模型(atmoshwm)
使用名称-值参数。返回单位为 m/s 的 M×2 数组 [经向风、纬向风]。
% Total wind with Ap index
wind = atmoshwm(-45, -85, 25000, model='total', day=150, ...
seconds=11*3600, apindex=80);
% Quiet wind at multiple altitudes (day/seconds must match array size)
wind = atmoshwm([50; 50], [-20; -20], [100000; 150000], ...
model='quiet', day=[30; 30], seconds=[0; 0]);
% Disturbed wind
wind = atmoshwm(70, -65, 150000, model='disturbance', day=166, seconds=0);
名称-值选项:model('quiet'|'disturbance'|'total')、day、seconds、apindex、version('14'|'07')。
重力:球谐函数
输入为行星中心行星固定(PCPF)[x,y,z] 坐标,单位为米——不是纬度/经度/高度。
% Earth: 25,000 m over South Pole (z-axis = polar axis)
[gx, gy, gz] = gravitysphericalharmonic([0, 0, -(6356752 + 25000)]);
% Mars GMM2B: equator + pole
pos = [3396200 + 15000, 0, 0; % equator
0, 0, 3376200 + 11000]; % north pole
[gx, gy, gz] = gravitysphericalharmonic(pos, 'GMM2B');
模型:'EGM2008'(默认)、'EGM96'、'LP100K'、'LP165P'、'GMM2B'、'EIGENGL04C'、'Custom'。
注意:扁球体上的极点位置会触发“径向位置小于赤道半径”警告——这是预期现象(极半径 < 赤道半径),结果仍然有效。
重力:WGS84
使用大地坐标(高度单位为米,纬度/经度单位为度)。
对于带可选效应的 Exact 方法,将标志作为单个向量 [noatm, nocent, prec, jd] 传入:
% Taylor series (default) — only h and lat, no method string
g = gravitywgs84(1000, 45);
% CloseApprox — requires lon as 3rd argument
g = gravitywgs84(1000, 45, 20, 'CloseApprox');
% Exact with precession — requires lon + flag vector
[gn, gt] = gravitywgs84(1000, 0, 20, 'Exact', [false, false, true, 2451545]);
调用方式:
- 默认(泰勒级数):
gravitywgs84(h, lat)——不要将 'TaylorSeries' 作为字符串传入 - CloseApprox:
gravitywgs84(h, lat, lon, 'CloseApprox')——需要 lon - Exact:
gravitywgs84(h, lat, lon, 'Exact', [noatm, nocent, prec, jd])——需要 lon 和标志向量
标志向量 [noatm, nocent, prec, jd]:
noatm:true = 排除大气修正nocent:true = 排除离心效应prec:true = 包含岁差jd:儒略日(0 = 不指定岁差日期)
重力:带谐函数
输入为单位为米的 PCPF [x,y,z]。Degree 为数值标量。
% Earth, 4th degree, at equator surface
Re = 6378137;
[gx, gy, gz] = gravityzonal([Re, 0, 0], 'Earth', 4);
% Mars at two positions
[gx, gy, gz] = gravityzonal([3396200+15000, 0, 0; 0, 0, 3376200+11000], 'Mars');
重力:离心力
输入为单位为米的 PCPF [x,y,z]。
% Earth at equator surface
[gx, gy, gz] = gravitycentrifugal([6378137, 0, 0]);
% Mars
[gx, gy, gz] = gravitycentrifugal([3396200, 0, 0], 'Mars');
磁场模型
wrldmagm 和 igrfmagm 都使用米为单位的高度、度为单位的纬度/经度,以及十进制年份。使用 decyear 转换日历日期。
% WMM-2025
[XYZ, H, D, I, F] = wrldmagm(1000, 40.44, -79.99, decyear(2025,7,4), '2025');
% IGRF-14
[XYZ, H, D, I, F] = igrfmagm(3000, 41.50, -81.69, decyear(2028,7,4), 14);
输出:XYZ = [北、东、下],单位为 nT;H = 水平强度;D = 磁偏角(度);I = 磁倾角(度);F = 总强度(nT)。
大地水准面高度和地心半径
% Geoid undulation (EGM96 default) — longitude must be [0, 360]
N = geoidheight(42.4, 289.0);
% EGM2008
N = geoidheight(42.4, 289.0, 'EGM2008');
% Geocentric radius at multiple latitudes (input: geocentric lat in degrees)
r = geocradius([0, 45, 90]); % default WGS84
r = geocradius([0, 45, 90], 'WGS84'); % explicit model
行星星历和地球定向
星历函数需要 aeroDataPackage 中的数据。所有函数都使用儒略日作为时间输入。
% Planet/Moon position and velocity (km, km/s by default)
jd = juliandate(2022, 10, 27, 12, 0, 0);
[pos, vel] = planetEphemeris(jd, 'Earth', 'Moon');
[pos, vel] = planetEphemeris(jd, 'SolarSystem', 'Mars', '430', 'AU');
% Earth nutation (radians)
[angles, rates] = earthNutation(jd); % angles = [dpsi, depsilon]
% Moon libration (radians)
[angles, rates] = moonLibration(jd); % 3 Euler angles + rates
% Earth polar motion (radians) — input is UTC as Julian date
utc = juliandate(2020, 1, 1);
[pm, pmError] = polarMotion(utc); % pm = [xp, yp]
% Celestial Intermediate Pole adjustment (radians)
[dcip, dcipError] = deltaCIP(utc); % dcip = [dX, dY]
% UT1-UTC difference (seconds)
[dut1, dut1Error] = deltaUT1(utc);
有效的 planetEphemeris 目标/中心:'Sun'、'Mercury'、'Venus'、'Earth'、'Moon'、'Mars'、'Jupiter'、'Saturn'、'Uranus'、'Neptune'、'Pluto'、'SolarSystem'、'EarthMoon'。
模型:'405'(默认)、'421'、'423'、'430'、'432t'。
注意:polarMotion、deltaCIP 和 deltaUT1 使用 aeroiersdata.mat 中的 IERS 数据(随包提供),也可使用自定义数据源。获取最新 IERS 数据:
% Download latest Earth orientation data and save as MAT file
iersFile = aeroReadIERSData(pwd);
% Then pass to Earth orientation functions via Source name-value
[pm, pmError] = polarMotion(utc, Source=iersFile);
[dcip, dcipError] = deltaCIP(utc, Source=iersFile);
[dut1, dut1Error] = deltaUT1(utc, Source=iersFile);
空间天气管线
用于生成真实 NRLMSISE-00 输入的完整管线:
% Step 1: Read CSV (downloaded from CelesTrack) into MAT file
% TEMPLATE — requires user-provided CSV file
matFile = aeroReadSpaceWeatherData('spaceWeatherFile.csv');
% Step 2: Extract flux and magnetic indices for a specific date/time
dt = datetime(2022, 10, 27, 6, 30, 0, 'TimeZone', 'UTC');
[f107avg, f107daily, magIdx] = fluxSolarAndGeomagnetic(dt, matFile, ...
F107ExtrapMethod='constant', MagneticIndexExtrapMethod='constant');
% Step 3: Feed into NRLMSISE-00
dayOfYear = day(dt, 'dayofyear');
UTsec = seconds(timeofday(dt));
[T, rho] = atmosnrlmsise00(400e3, 45, -50, dt.Year, dayOfYear, UTsec, ...
f107avg, f107daily, magIdx, 'NoOxygen');
注意:
aeroReadSpaceWeatherData接受用户提供的 CSV(CelesTrack 格式)——工具箱不附带示例文件- 它会返回一个包含空间天气数据的 MAT 文件,供
fluxSolarAndGeomagnetic使用 - 如果未提供 CSV,可使用预先构建的
aeroSpaceWeatherData.mat(通过which('aeroSpaceWeatherData.mat')获取) fluxSolarAndGeomagnetic接受(datetime, matFile)或(year, dayOfYear, UTCseconds, matFile)
常见错误
| 错误 | 失败原因 | 正确做法 |
|---|---|---|
将纬度/经度/高度传给 gravitysphericalharmonic | 需要以米为单位的 PCPF [x,y,z] | 转换为笛卡尔坐标:赤道表面 = [Re, 0, 0],极点 = [0, 0, Rp] |
对 atmosnonstd 使用名称-值对 | 使用位置字符串,而非名称-值参数 | atmosnonstd(h, 'Envelope', 'High pressure', '20%') |
向 gravitywgs84 Exact 传入单独的布尔参数 | 标志必须是单个向量 | gravitywgs84(h, lat, lon, 'Exact', [noatm, nocent, prec, jd]) |
将 'TaylorSeries' 作为方法字符串传入 | 需要方法参数时,它是第三个参数 | 使用双参数形式:gravitywgs84(h, lat)——不传入方法字符串 |
在未提供经度时调用 gravitywgs84(h, lat, 'CloseApprox') | CloseApprox 需要经度 | gravitywgs84(h, lat, lon, 'CloseApprox') |
对 Envelope 类型指定 extremeAltitude | 仅适用于 Profile 类型 | Envelope 不要指定该参数:atmosnonstd(h, 'Envelope', param, freq) |
使用 atmosnrlmsise00 获取风 | 函数不正确 | 使用 atmoshwm 获取水平风 |
调用 gravitywgs84 获取离心效应 | 没有仅计算离心效应的模式 | 使用 gravitycentrifugal([x, y, z]) |
使用错误的函数名称 gravityzonalharmonic | 该函数不存在 | 使用 gravityzonal |
向 gravityzonal 传入字符串形式的阶数 | 需要数值标量 | 使用 gravityzonal(coords, 'Earth', 4),而非 '4thDegree' |
忽略 aeroReadSpaceWeatherData 的输出 | 它会返回一个包含空间天气数据的 MAT 文件 | 将返回的 MAT 文件传给 fluxSolarAndGeomagnetic |
约定
- 高度单位: 所有大气、重力和磁场函数均使用米(而非 km 或英尺)
- 纬度/经度: 大地测量函数使用度;
gravitysphericalharmonic、gravityzonal、gravitycentrifugal使用以米为单位的 PCPF [x,y,z] - 十进制年份: 磁场模型的日期输入使用
decyear(year, month, day) - 时间:
day= 一年中的第几天(1-366);seconds= 自 UTC 午夜起的秒数 - PCPF 坐标: x 轴穿过 0N/0E,y 轴穿过 0N/90E,z 轴指向北极
geoidheight经度: 必须在 [0, 360] 度范围内(东经为正)。使用mod(lon, 360)将 [-180, 180] 转换为该范围- PCPF 中的南极:
[0, 0, -(Rp + altitude)],其中 Rp 为极半径 - PCPF 中的赤道:
[Re + altitude, 0, 0],其中 Re 为赤道半径
Copyright 2026 The MathWorks, Inc.