Main Content

Cartesian State Vectors to Keplerian Orbital Elements

Calculate Keplerian orbital elements from orbital state vectors in equatorial coordinate system of celestial bodies

Since R2026a

  • Cartesian State Vectors to Keplerian Orbital Elements block

Libraries:
Aerospace Blockset / Spacecraft / Spacecraft Dynamics

Description

The Cartesian State Vectors to Keplerian Orbital Elements block calculates Keplerian orbital elements from orbital state vectors in a celestial body-centered equatorial coordinate system. Keplerian orbital elements are defined with respect to the Earth Centered Inertial (ECI) coordinate system.

Ports

Input

expand all

Position array, specified as a 3-by-1 or 1-by-3 array.

Data Types: double

Velocity array, specified as a 3-by-1 or 1-by-3 array.

Data Types: double

Output

expand all

Semimajor axis (half of the longest diameter) of the orbit, returned as a positive scalar.

Data Types: double

Orbit eccentricity (deviation of orbital curve from circular), returned as a value greater than or equal to 0 for orbit type Keplerian, or a value between 0 and 1 for orbit type Elliptical.

Data Types: double

Inclination, returned as a positive scalar:

  • Value between 0 and 180, in degrees

  • Value between 0 and pi, in radians

Data Types: double

Right ascension of ascending node, returned as a positive scalar:

  • Value between 0 and 360, in degrees

  • Value between 0 and 2*pi, in radians

Data Types: double

Angle between the spacecraft ascending node and the periapsis (argument of periapsis), returned as a positive scalar:

  • Value between 0 and 360, in degrees

  • Value between 0 and 2*pi, in radians

Data Types: double

Angle between periapsis and current position of spacecraft (true anomaly), returned as a positive scalar:

  • Value between 0 and 360, in degrees

  • Value between 0 and 2*pi, in radians

Data Types: double

Angle between x-axis and the spacecraft position vector (true longitude), returned as a positive scalar:

  • Value between 0 and 360, in degrees

  • Value between 0 and 2*pi, in radians

Dependencies

To enable this port, set Output port configurations to All.

Data Types: double

Angle between ascending node and the spacecraft position vector (argument of latitude), returned as a positive scalar:

  • Value between 0 and 360, in degrees

  • Value between 0 and 2*pi, in radians

Dependencies

To enable this port, set Output port configurations to All.

Data Types: double

Angle between the x-axis and the eccentricity vector (longitude of periapsis), returned as a positive scalar:

  • Value between 0 and 360, in degrees

  • Value between 0 and 2*pi, in radians

Dependencies

To enable this port, set Output port configurations to All.

Data Types: double

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Parameter and port units, specified as Metric (m/s), Metric (km/s), Metric (km/h), English (ft/s), or English (kts).

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

To get the block parameter value programmatically, use the get_param function.

Parameter: units
Values: Metric (m/s) (default) | Metric (km/s) | Metric (km/h) | English (ft/s) | English (kts)

Angle units, specified as Degrees or Radians.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

To get the block parameter value programmatically, use the get_param function.

Parameter: angleUnits
Values: Degrees (default) | Radians

Control output ports to display, specified as:

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

To get the block parameter value programmatically, use the get_param function.

Parameter: outputPortConfiguration
Values: Keplerian (default) | All

Celestial body around the spacecraft orbits, specified as Earth, Moon, Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune, Sun, or Custom.

Programmatic Use

Block Parameter: centralBody
Type: character vector
Values: 'Earth' | 'Moon' |'Mercury' | 'Venus' | 'Mars' | 'Jupiter' | 'Saturn' | 'Uranus' | 'Neptune' | 'Sun' | 'Custom'
Default: 'Earth'

Tolerance for orbit circular or parabolic orbit eccentricity, or equatorial orbit inclination, in radians, specified as a finite positive scalar.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

To get the block parameter value programmatically, use the get_param function.

Parameter: tolerance
Values: 1e-12 (default) | finite positive scalar
Data Types: double

Action when orbit is opened or undefined, specified as Warning, None, or Error.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

To get the block parameter value programmatically, use the get_param function.

Parameter: action
Values: Warning (default) | None | Error

Algorithms

In orbital mechanics, six classical orbital elements define elliptical orbits around a central body:

  • Eccentricity (e)

  • Semimajor axis (a)

  • Inclination (i)

  • Right ascension of ascending node (Ω)

  • Argument of periapsis (ω)

  • True Anomaly (v)

These elements help engineers and scientists understand the trajectory and position of a satellite or celestial body.

This block also takes into account these additional orbital elements:

  • True longitude (l) — Angle from the reference direction to the orbiting body. This element is used for circular-equatorial orbits because both the right ascension of the ascending node and the argument of periapsis are undefined.

    l = v

    In this equation, true longitude l is used in place of the right ascension of the ascending node, the argument of periapsis, and the true anomaly.

  • Argument of latitude (u) — Angle from the ascending node to the orbiting body. This element is used for circular-inclined orbits because the argument of periapsis is undefined.

    u = v

    In this equation, argument of latitude (u) is used in place of the argument of periapsis and the true anomaly.

  • Longitude of periapsis (ϖ) — Angle from the reference direction to the periapsis. This element is used for elliptical-equatorial orbits because the right ascension of the ascending node is undefined.

    ϖ = Ω+ω

    In this equation, longitude of periapsis (ϖ) is used in place of the right ascension of the ascending node and the argument of periapsis.

For more information on the Keplerian orbital elements, see Orbit Propagation Methods.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2026a