help-octave
[Top][All Lists]

## RE: Smoothing a roughly sinusoidal signal

 From: llrjt100 Subject: RE: Smoothing a roughly sinusoidal signal Date: Thu, 7 Nov 2019 16:57:57 -0600 (CST)

```Encoder interpolation error manifests as a regular periodic error in the
encoder position count when the encoder codewheel is rotating at constant
angular velocity. It's optically related to the number of lines on the
encoder codewheel (in this case 3600). In this dataset I've posted, the
codewheel, which is mounted on the gearbox output shaft, turns once every
86,164 seconds. This gives a encoder interpolation error period of 86,164
secs per rev / 3600 lines per rev = ~24 secs.

In terms of an algorithm/equation - the following periodic errors appear in
the encoder position data:

1. An encoder interpolation error sinusoid with period = secs per encoder
full rev / 3600 lines per rev. This has sub harmonics - the most significant
can be seen at approximately half this period.

2. A faster microstep error sinusoid with period approximately = 4x (secs
per encoder full rev / (gearbox ratio x 400))

All stepper motors have rotor positioning error - typically +/- 5%. Every
electrical cycle (4 full steps with a 2 phase stepper motor), this error
get's repeated. This can be seen as the ~2 s error in the graph I've posted.
Gearbox transmission error adds to this, so the resulting encoder position
is no longer directly correlated to the theoretical stepper motor position
(microstep count).

My gut feeling for the solution to this problem is to realtime fit a
sinusoid to the encoder position data, then use the sinusoid to correct the
current encoder position value. I'm not a signal processing engineer, so I
could well be completely wrong. I ran this by an academic friend earlier
this week, and they thought a Kalman filter would be the best solution. The
problem is I've no idea how to implement this...

--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

```