I am quite new Digital Signal Processing.I am trying to implement anti-cogging algortihm for my permanent magnet synchronous motor (=PMSM) control algortihm. I follow this documentation

I collected velocity data according to the rotation angle. I have 1024 bytes long sampling buffer. Each sample is stored when my rotation encoder gave a pulse, so each index actually means mechanical rotation angle. Each stored value is the velocity at related angle.

I transformed the collected samples to frequency domain with FFT. It's not clear to me what is my Fs (=sampling frequency). When I examined the frequency spectrum, dominant harmonics are related multiplies of 14 - 27 index numbers which is number of slot(27) and number of pp(14).

But the last step of the suggested method, Acceleration Based Waveform Analysis, need calculated derivative of FFT outputs with respect to time. Outputs are in frequency domain, so how could I calculate derivative of FFT outputs with respect to time and why does the method need this calculation?

  • \$\begingroup\$ I haven't read the paper (the link won't open), but are you sure you don't have to perform differentiation in time domain, then FFT? It would make sense: velocity -> acceleration. \$\endgroup\$ Apr 6, 2021 at 6:22
  • \$\begingroup\$ Sorry but I can open link , I don't know what is problem. This is another documentation relevant this topic : ' roboticsproceedings.org/rss10/p42.pdf ' \$\endgroup\$ Apr 6, 2021 at 8:19
  • \$\begingroup\$ I tried to decipher your new version of the question. Roll back the edit if it doesn't present any more your problem. \$\endgroup\$
    – user136077
    Apr 6, 2021 at 21:43

1 Answer 1


This answer is obsolete. It tells only how to calculate the Fourier transform of a derivative if the Fourier transform of the original function is known. The actual problem is revealed in comments and the question is fixed.

A great part of the problem is how to get the angular acceleration as a function of rotation angle when the measurements are made by recording the angular velocity i.e. the rotation speed as a function of rotation angle. A sample of rotation speed has been stored every time the motor has rotated a certain angle increment. The sample queue contains 1024 samples (no scaling info is included).

The final goal is to make movements smooth in a robot by implementing an anti-gogging system. Usual robot motors with simplest possible drive pulses generate non-uniform torque which make movements twitching. The torque smoothing will be tried by using PWM to generate more complex drive pulses which compensate twitches

The torque variations cannot be properly measured from motor current and voltage. because they are caused by structural non-uniformities such as reluctance variation due rotation

The useless original answer:

You obviously want the spectrum of the acceleration and you already have the spectrum of the velocity. I do not know what exact notation you use, but let's name to Vk the complex valued sample in the spectrum. k is the index and k=0 means the DC component.

Let's assume your physical sampling period is T, so your adjacent points Vk and V(k+1) have physical frequency difference 1/T.

The spectrum of the acceleration can be calculated as follows:

Ak = (Vk) * j * 2Pi *k/T

where j is the imaginary unit.

This is taken from the general properties of the Fourier transform - how to calculate the transform of the time derivative of a function. The original transform should be multiplied by

j* 2Pi * f

where f is the frequency.

I guess you have searched the formula for Ak from writings of DFT. It's not there. Discrete time signals do not have such thing as time derivative. This is a special case. Now the signal was assumed to be a chain of samples of continuous time signal which has the derivative.

  • \$\begingroup\$ Thank you for your quick response. If I calculate spectrum of accelaration with ' Ak = (Vk) * j * 2Pi *k/T ' this formula , the results are frequency domain . When I transport results with inverse FFT in time domain , is the results same thing with motor accelaration. If It is , why It dont directly calculate accelaration in time domain? Dont become angry me If it is stupid question . I am really newbie. \$\endgroup\$ Apr 6, 2021 at 8:13
  • \$\begingroup\$ Ak inverted back to time domain should give the acceleration if the Vk inverted give the velocity scaled right with the same inversion formula. It was my guess that you have the velocity only in frequency domain and you want the acceleration in frequency domain. If you have time domain velocity data you can well calculate the acceleration in time domain and if the spectrum of the acceleration is actually needed for something, calculate it from the time domain acceleration. \$\endgroup\$
    – user136077
    Apr 6, 2021 at 8:21
  • \$\begingroup\$ Just be careful of noise, as a derivative in time or a multiplication by frequency imply an amplification of noise. Removing higher frequency bins of the resulting Ak spectrum might help before anti-transforming back to time. \$\endgroup\$
    – andrea
    Apr 6, 2021 at 8:59
  • \$\begingroup\$ I confused one more thing , I have buffer with 1024 byte size. Each index mean encoder pulse so each index actually mechanical angle. And each value is velocity with related mechanical angle. I transported this buffer frequency domain with FFT. What is my Fs (sampling frequency). When i examined to frequency spectrum , dominant harmonics are related multiplies of 14 - 27 index numbers which is number of slot(27) and number of pp(14). So Fs should be 1000 Hz . But how to calculate this value I don't know. \$\endgroup\$ Apr 6, 2021 at 9:01
  • \$\begingroup\$ So, you have the velocity as a function of rotation angle, not as a function of time. This makes things complex and it also makes my answer useless - no matter it presents something which can be called an elementary math fact. Now: Rewrite the question to contain more precisely what you have and what you are going to calculate from what you have and do it without creating a need to walk through a massive motor stabilization theory. Interpreting the stabilization theory is totally another subject of question. I'll fix the answer if my skills are good enough. \$\endgroup\$
    – user136077
    Apr 6, 2021 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.