A Case Study: Attitude Interpolation and Differentiation in STK

This case study shows how to compute angular velocity and acceleration in STK. It generates three attitude files for time steps of 1, 10, and 60 seconds. Differences in the resulting attitude files are explained below.

Whenever derivative information is not available, STK resorts to numerical differentiation. The default method is central differencing, if possible. Otherwise, the method is forward or backward differencing at the end points. Derivative information may be absent for two reasons. One is that the data files do not include it. The other is because some formulae or custom plugin attitude definitions did not supply it. This often happens because an analytical derivative is very cumbersome to compute compared to numerical differentiation.

The majority of functional interfaces in STK provide both the function and its first derivative. This is to accommodate sampling strategies for applying threshold crossing in visibility computations.

These two factors result in second- and higher-order derivatives (but usually not the first-order derivatives) computed using numerical differencing.

We must give special consideration to sampled data. STK derives the function, based on sampled data, using polynomial interpolation. Interpolation methods may include differing numbers of sampled points, which results in polynomials of different degrees. Any available derivative information at the sampled points can be included in polynomials. This yields functions that not only pass through the sampled points but also pass through them with required slopes. In this case, derivative information is not available. Thus, the higher-order polynomials produce the more differentiable functions. For example, first-order polynomials produce continuous but not smooth functions. This is because first derivatives of such functions are discontinuous. Note that second-order polynomials produce functions that are both continuous and smooth. This is due to their first derivatives being continuous. Higher-order polynomials produce smoother functions, but they are also susceptible to extraneous oscillations or “ringing.” This can generate interpolated values that deviate significantly from the sampled points. The best practice is to generate enough samples, as prescribed by the Nyquist period. Then you can use a low-order polynomial to interpolate between them.

Let's examine specifics of the case at hand. We have three files with attitude data sampled at three different periods (1 second, 10 seconds, and 60 seconds). Each file includes only quaternion samples. The default interpolation order for attitude data is 1. When applied to attitude, first-order interpolation produces a fixed rate eigenaxis slew between any two sampled points. The rate change is discontinuous when transitioning from one pair of attitude samples to the next. When passing this data through a numerical differencing routine, the angular acceleration becomes either zero or some finite value, depending on how the samples used for differencing fall in the samples in the file. In STK, the central differencing of attitude data is set to use points +/-0.1 seconds apart from the time of interest. This is smaller than 1 second (the smallest data sampling among the presented three cases). Thus, all sampling cases produce angular accelerations that remains at zero most of the time. However, they spike to some finite value whenever central differencing samples fall on opposite sides of the attitude sample in the file. The size of each spike depends on the differences in angular velocity values across the discontinuity divided by the differencing interval (0.2 seconds for central differencing). See Attitude Data Using 1 Second Samples and First Order Attitude Interpolation.

AGI does not recommend attempting numerical differencing on discontinuous data. There are two ways to solve the problem:

  1. Include sampled angular velocity data in the files and preserve first-order interpolation. This is preferable because it generates more accurate and well-behaved interpolated functions. Besides Lagrange, it can support Hermite interpolation. This can prevent aliasing of revolutions and ringing, which are common with sparse cyclical data.
  2. Interpolate attitude using second or higher orders of interpolation without sampled angular velocity. This may improve computation of angular acceleration in the absence of angular velocity samples. Yet, it may also suffer from high sensitivity to sample errors and from Runge’s phenomenon: large departures of the interpolation polynomial from sampled points. This result is illustrated where linear, quadratic, and cubic attitude interpolations are applied to generate angular velocity and angular acceleration plots based on 60-second attitude samples. Both quadratic and cubic interpolations produce angular accelerations that change gradually (although still fast at times). They also no longer jump between zero and non-zero values. Cubic interpolation produces smoother angular velocity than quadratic interpolation. At the same time, there are significant discrepancies in angular acceleration. This is due to interplay between original attitude samples and interpolated samples used for numerical differentiation. In general, higher derivatives of the interpolated data can be obtained analytically by repeated differentiation of the interpolation polynomials.

You can select either of these options with simple keywords in an Attitude file.

Attitude data using 1-second samples and first-order attitude interpolation

The following figure shows angular velocity in J2000 using 1-second samples and first-order attitude interpolation.

The following figure shows angular acceleration in J2000 using 1-second samples and first-order attitude interpolation.

The following figure shows details of angular acceleration in J2000 using 1-second samples and first-order attitude interpolation for the first 30 minutes.

Attitude data using 10-second samples and first-order attitude interpolation

The following figure shows details of angular velocity in J2000 using 10-second samples and first-order attitude interpolation.

The following figure shows details of angular acceleration in J2000 using 10-second samples and first-order attitude interpolation.

The following figure shows details of angular acceleration in J2000 using 10-second samples and first-order attitude interpolation for the first 30 minutes.

Attitude data using 60-second samples and first-order attitude interpolation

The following figure shows details of angular velocity in J2000 using 60-second samples and first-order attitude interpolation.

The following figure shows angular acceleration in J2000 using 60-second samples and first-order attitude interpolation.

The following figure shows angular acceleration in J2000 using 60-second samples and first-order attitude interpolation for the first 30 minutes.

Attitude data using 1-second samples and second-order attitude interpolation

The following figure shows angular velocity in J2000 using 1-second samples and second-order attitude interpolation.

The following figure shows angular acceleration in J2000 using 1-second samples and second-order attitude interpolation.

Attitude data using 10-second samples and second-order attitude interpolation

The following figure shows angular velocity in J2000 using 10-second samples and second-order attitude interpolation.

The following figure shows angular acceleration in J2000 using 10-second samples and second-order attitude interpolation.

Attitude data using 60-second samples and second-order attitude interpolation

The following figure shows angular velocity in J2000 using 60-second samples and second-order attitude interpolation.

The following figure shows angular acceleration in J2000 using 60-second samples and second-order attitude interpolation.

Attitude data using 1-second samples and third-order attitude interpolation

The following figure shows angular velocity in J2000 using 1-second samples and third-order attitude interpolation.

The following figure shows angular acceleration in J2000 using 1-second samples and third-order attitude interpolation.

Attitude data using 10-second samples and third-order attitude interpolation

The following figure shows angular velocity in J2000 using 10 second samples and third-order attitude interpolation.

The following figure shows angular acceleration in J2000 using 10-second samples and third-order attitude interpolation.

Attitude data using 60-second samples and third-order attitude interpolation

The following figure shows angular velocity in J2000 using 60-second samples and third-order attitude interpolation.

The following figure shows angular acceleration in J2000 using 60-second samples and third-order attitude interpolation.