Reducing harmonics in the resonance testing signal

Analytically, I didn’t find any even harmonic. Both waveforms have odd symmetries at +/- T/4, where the acceleration sign flips, or at the middle of the cruise segment. This cancel out the inner product with sine bases at 2*n*frequency.

You can find the patch in the first post of this thread. This should be enough to replicate the wave-form. A simulated acceleration signal would be very welcome, thanks. :slight_smile:


To experiment with the effect of the stepper position, I modified the resonance_tester code to sweep positions instead of frequencies. At each iteration a very small offset (83.33 nm) is added to the backstroke. Over the course of the 6 min long test, the toolhead travels 3 electrical cycles, 12 steps, or 2.4 mm.


(I tweaked the visualization with vmin, vmax = np.quantile(pdata, [0.25, 0.999]) and noverlap=M - M//4.)

  • The second and fourth harmonics go in and out twice per step.
  • The 3rd harmonic, which is present in the ideal signal, also shows some modulation, but once per step.
  • Overall the positions with the least amount of harmonics seems to be half-steps.
  • The electrical cycle is marked by these wide band noise patterns at 150-400 Hz. Otherwise, there is no other pattern that is different on each of the 4 steps, as suggested here. But these results might be specific to this test (and 40Hz frequency).
  • The 6-10th harmonics seems to show faster paced patterns, but it’s quite faint and low resolution. I could try to stretch the test even more in time.

The spectrogram above used the modified wave form. This one is using the original square-wave:


Very similar beside the stronger 3rd harmonic.

Edit: I repeated the test above but over 4 steps for a duration of 10 min. I plotted the power of the first 5 harmonics over the central position of the oscillation:


It appears that the pattern on the 2nd harmonic has a period of 2 steps.

I’m not sure where I’m going with this. I guess this shows that harmonics are generated by the stepper themself, so it’s less relevant to try to remove them from the test signal. On the other hand, there is less effect on even harmonics, likely because they are already present in the test signal, showing room for improvement.