Problem Bank · Orbit Propagation · Frame Debugging

TEME vs ECI vs ECEF Frame Confusion

Why your orbit looks wrong in MATLAB but correct in STK

Orbit propagation is not only about equations. A state vector is meaningless unless you know which frame it belongs to, at what epoch it was defined, and how Earth rotation has been handled.

Frames TLE SGP4 STK MATLAB Ground Tracks Debugging
Core message: A propagated state only makes sense when the coordinate frame, epoch, time system, units, and Earth-rotation model are handled consistently. This page turns that idea into an interactive debugging problem.
1 · Mission-Style Problem Setup

Why does the same satellite appear over the wrong longitude?

You propagate a satellite from a TLE in MATLAB using SGP4. Then you compare the result with STK.

What looks correct

The altitude looks reasonable. The orbital period looks reasonable. The 3D orbit shape looks reasonable.

What looks wrong

The ground track is shifted. The position error grows strangely. The satellite appears over the wrong longitude.

The debugging question: Is the propagator wrong? Is STK wrong? Or are you comparing different frames?
2 · Core Concept

The Same Vector Can Mean Different Things

A state vector [r, v] is not complete information by itself. You must also know the frame, epoch, time scale, Earth model, and units.

Frame

TEME, ECI, ECEF, GCRF, ITRF. The numbers only become meaningful after the frame is known.

Epoch

The exact time the state is valid. Even a small timing offset can create an along-track error.

Time Scale

UTC, UT1, TT, TAI. Orbit tools may use different time standards internally.

Earth Model

Precession, nutation, polar motion, Earth rotation, and Earth orientation parameters affect transformations.

Units

km versus m, km/s versus m/s, degrees versus radians. Unit mistakes can destroy a simulation instantly.

Software Convention

STK, MATLAB, GMAT, SPICE, and custom scripts may name or output frames differently.

Key line: A 7000 km vector in TEME is not automatically the same physical direction as a 7000 km vector in ECEF.
3 · Frame Comparison Table

TEME, ECI, ECEF, and Local Frames

The table below is the minimum frame literacy needed before comparing MATLAB, STK, TLE, or ground-track outputs.

Frame Rotates with Earth? Common use Risk
TEME No, but tied to true-equator / mean-equinox convention SGP4 / TLE output Often treated incorrectly as generic ECI
ECI / GCRF No Inertial dynamics and orbit propagation Must know the exact inertial definition
ECEF / ITRF Yes Latitude, longitude, ground stations, Earth-fixed geometry Cannot propagate two-body motion directly without rotating-frame terms
Local ENU / NED Yes, local surface frame Antenna pointing, elevation, azimuth, local navigation Valid only for the selected ground site
4 · Interactive Frame Selector

Frame Viewer: Inertial Orbit vs Rotating Earth

Use the controls to see how an inertial-looking satellite position maps to an Earth-fixed ground track. The simplified model is educational: it isolates the Earth-rotation effect instead of implementing a full TEME-to-ITRF pipeline.

Earth rotation angle 15.0°
Apparent longitude shift 15.0°
Frame risk High
Debug clue Ground track
Main lesson: After only one hour, Earth rotates by about 15 degrees. If an inertial vector is plotted as if it were Earth-fixed, the ground location will be wrong even when the orbit itself looks reasonable.
5 · MATLAB vs STK Mismatch Simulator

Why MATLAB and STK Disagree

A mismatch does not automatically mean one tool is wrong. Toggle the assumptions and inspect the diagnostic card.

Likely error source: output frame mismatch

TEME may be interpreted as ECEF or generic ECI. Expected symptom: correct orbit shape but wrong longitude or ground track.

6 · Error Growth from the Wrong Frame

Error Symptom Explorer

Select a common mistake and observe the approximate error signature. This does not replace high-fidelity validation, but it teaches what type of symptom each mistake usually creates.

Apparent position error ?
Longitude shift ?
Ground-track error type ?
Likely debugging cause ?
Large longitude shift but realistic altitude

Usually a frame or Earth-rotation problem.

Large along-track offset

Usually an epoch, mean anomaly, or propagation-start-time problem.

Orbit explodes

Usually a unit or dynamics problem.

Wrong inclination appearance

Usually an axis convention or frame definition problem.

7 · Frame Debugging Checklist

How to Debug the Problem Systematically

1. Identify the source frame

Is the state from TLE/SGP4, STK, MATLAB, GMAT, SPICE, or another source?

2. Identify the output frame

TEME, GCRF, J2000, ITRF, ECEF, LVLH, or local topocentric?

3. Match the epoch exactly

Do not compare states at slightly different times.

4. Match units

Check km/m, km/s/m/s, degrees/radians, and time units.

5. Convert before comparing

Never compare TEME directly with ECEF.

6. Compare simple quantities first

Altitude, semi-major axis, period, and inclination.

7. Then compare vector quantities

Position, velocity, RAAN, argument of perigee, and anomaly.

8. Finally compare ground track

Ground track is highly frame-sensitive.

8 · Symptom → Cause Diagnostic Table

What the Error Pattern Usually Means

Symptom Likely cause
Orbit shape looks correct but longitude is shiftedInertial / ECEF mismatch
Altitude is correct but ground track is wrongEarth rotation not applied
Error grows mostly along-trackEpoch or mean anomaly mismatch
Orbit appears rotatedFrame convention mismatch
Orbit explodes immediatelyUnit error
STK and MATLAB agree at epoch but diverge laterPropagator or model mismatch
Latitude seems reasonable but longitude is wrongECI / ECEF conversion issue
Ground station access times differFrame, Earth orientation, or time-system mismatch
9 · Code Pitfalls

Python and MATLAB Pseudo-Code

The mistake is usually not in the plotting command. The mistake is treating a vector from one frame as if it already belonged to another frame.

# Wrong idea:
# Treating TEME position directly as ECEF
lat, lon, alt = ecef_to_lla(r_teme)

# Better idea:
# Convert TEME -> inertial/reference frame -> ECEF/ITRF first
r_ecef = teme_to_ecef(r_teme, epoch, earth_orientation)
lat, lon, alt = ecef_to_lla(r_ecef)
% Wrong:
lla = ecef2lla(r_teme');

% Correct idea:
% 1. propagate TLE with SGP4
% 2. keep track of TEME frame
% 3. convert TEME to ECEF/ITRF at the same epoch
% 4. then compute latitude/longitude/altitude
10 · Engineering Interpretation

Why This Matters in Real GNC and Mission Analysis

Frame mistakes can cause false conclusions about mission performance, sensor pointing, or software validation.

Ground station access

A satellite may appear visible or invisible at the wrong time.

Sensor pointing

A camera or antenna may point to the wrong Earth location.

Orbit determination

Residuals may look like model error when they are actually frame error.

SSA and conjunction analysis

Wrong frame handling can create misleading position differences.

MATLAB/STK validation

A mismatch does not always mean the propagator is wrong.

Interview-level reasoning

The strongest answer is to ask what frame, epoch, time system, and model are being compared.

11 · Final Takeaway

A state vector is not just numbers.

It is:

position velocity frame epoch time system Earth model
If any one of these is missing, the orbit may look mathematically correct but physically wrong.
Best interview line: When MATLAB and STK disagree, the first question is not “which software is wrong?” The first question is “are we comparing the same physical quantity in the same frame at the same epoch?”