$npx -y skills add matlab/matlab-agentic-toolkit --skill matlab-convert-aerospace-coordinatesPerform aerospace unit conversions, time conversions, coordinate frame transformations, and rotation representations using Aerospace Toolbox. Use when converting units (length, velocity, angle, acceleration, angular velocity, force, mass, pressure, temperature, density), computin
| 1 | # Aerospace Fundamentals |
| 2 | |
| 3 | Core Aerospace Toolbox functions for unit conversions, time conversions, coordinate transformations, and rotation representations. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - Converting between aerospace unit systems (SI, imperial, nautical) |
| 8 | - Computing Julian dates, modified Julian dates, decimal years, or TDB time |
| 9 | - Transforming positions between ECEF, ECI, LLA, or flat Earth frames |
| 10 | - Converting between geodetic and geocentric latitude |
| 11 | - Building DCMs for frame transformations (ECI↔ECEF, ECEF↔NED, body↔wind, body↔stability) |
| 12 | - Converting between Euler angles, DCMs, quaternions, and Rodrigues vectors |
| 13 | - Using the `quaternion` object for rotation math, interpolation, or composition |
| 14 | - Identifying which coordinate frame data is expressed in |
| 15 | |
| 16 | ## When NOT to Use |
| 17 | |
| 18 | - Atmosphere models (`atmosisa`, `atmoscoesa`) — use `matlab-compute-aerospace-environment` |
| 19 | - Airspeed corrections (`correctairspeed`) — not covered here |
| 20 | - Orbit propagation or satellite maneuvers — use Aerospace Toolbox, Aerospace Blockset or Satellite Communications Toolbox |
| 21 | - Navigation-specific transforms (`lla2enu`, `lla2ned`) — use Navigation Toolbox |
| 22 | - Simulink blocks — use `/model-based-design-core:building-simulink-models` with Aerospace Blockset |
| 23 | |
| 24 | ## Workflow |
| 25 | |
| 26 | 1. **Identify the coordinate frame** — Determine what frame your data is in and what frame you need. See `references/coordinate-systems.md` for frame definitions and decision guide. |
| 27 | 2. **Convert units first** — Ensure inputs match the function's expected units before calling transforms. |
| 28 | 3. **Apply the transformation** — Use the appropriate function with correct argument ordering. |
| 29 | 4. **Verify** — Round-trip the result back to the original frame; error should be < 1e-10. |
| 30 | |
| 31 | ## Key Functions |
| 32 | |
| 33 | ### Unit Conversions |
| 34 | |
| 35 | | Function | Converts | Units | |
| 36 | |----------|----------|-------| |
| 37 | | `convlength` | Length | `'ft'`, `'m'`, `'km'`, `'in'`, `'mi'`, `'naut mi'` | |
| 38 | | `convvel` | Velocity | `'ft/s'`, `'m/s'`, `'km/s'`, `'in/s'`, `'km/h'`, `'mph'`, `'kts'`, `'ft/min'` | |
| 39 | | `convang` | Angle | `'deg'`, `'rad'`, `'rev'` | |
| 40 | | `convacc` | Acceleration | `'ft/s^2'`, `'m/s^2'`, `'km/s^2'`, `'in/s^2'`, `'km/h-s'`, `'mph/s'`, `'G''s'` | |
| 41 | | `convangacc` | Angular acceleration | `'deg/s^2'`, `'rad/s^2'`, `'rpm/s'` | |
| 42 | | `convangvel` | Angular velocity | `'deg/s'`, `'rad/s'`, `'rpm'` | |
| 43 | | `convforce` | Force | `'N'`, `'lbf'` | |
| 44 | | `convmass` | Mass | `'kg'`, `'lbm'`, `'slug'` | |
| 45 | | `convpres` | Pressure | `'Pa'`, `'psi'`, `'psf'`, `'atm'` | |
| 46 | | `convtemp` | Temperature | `'K'`, `'R'`, `'F'`, `'C'` | |
| 47 | | `convdensity` | Density | `'kg/m^3'`, `'slug/ft^3'`, `'lbm/ft^3'`, `'lbm/in^3'` | |
| 48 | |
| 49 | All conversion functions use the same signature: `output = convXXX(value, fromUnit, toUnit)` |
| 50 | |
| 51 | ### Time Conversions |
| 52 | |
| 53 | | Function | Purpose | Since | |
| 54 | |----------|---------|-------| |
| 55 | | `juliandate` | Calendar → Julian Date | R2006b | |
| 56 | | `mjuliandate` | Calendar → Modified Julian Date (JD − 2400000.5) | R2006b | |
| 57 | | `decyear` | Calendar → decimal year | R2006b | |
| 58 | | `leapyear` | Test if year is leap year | R2006b | |
| 59 | | `tdbjuliandate` | Terrestrial Time → TDB Julian Date | R2015a | |
| 60 | |
| 61 | ### Coordinate Transformations |
| 62 | |
| 63 | | Function | From | To | Since | |
| 64 | |----------|------|-----|-------| |
| 65 | | `lla2ecef` | LLA (geodetic) | ECEF | R2006b | |
| 66 | | `ecef2lla` | ECEF | LLA (geodetic) | R2006b | |
| 67 | | `lla2eci` | LLA | ECI | R2014a | |
| 68 | | `eci2lla` | ECI | LLA | R2014a | |
| 69 | | `ecef2eci` | ECEF (pos/vel/acc) | ECI | R2019a | |
| 70 | | `eci2ecef` | ECI (pos/vel/acc) | ECEF | R2019a | |
| 71 | | `eci2aer` | ECI | AER (azimuth, elevation, range) | R2015a | |
| 72 | | `lla2flat` | LLA | Flat Earth | R2011a | |
| 73 | | `flat2lla` | Flat Earth | LLA | R2011a | |
| 74 | | `geod2geoc` | Geodetic latitude | Geocentric latitude | R2006b | |
| 75 | | `geoc2geod` | Geocentric latitude | Geodetic latitude | R2006b | |
| 76 | | `dcmeci2ecef` | — | ECI-to-ECEF DCM | R2013b | |
| 77 | | `dcmecef2ned` | — | ECEF-to-NED DCM | R2006b | |
| 78 | | `dcm2latlon` | ECEF-to-NED DCM | Lat/Lon | R2006b | |
| 79 | | `dcmbody2wind` | Alpha, Beta | Body-to-Wind DCM | R2006b | |
| 80 | | `dcm2alphabeta` | Body-to-Wind DCM | Alpha, Beta | R2006b | |
| 81 | | `dcmbody2stability` | Alpha | Body-to-Stability DCM | R2022a | |
| 82 | |
| 83 | ### Rotation Representations |
| 84 | |
| 85 | | Function | From | To | Since | |
| 86 | |----------|------|-----|-------| |
| 87 | | `angle2dcm` | Euler angles | DCM | |