Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: differentiation a fourier transform in frequency (Read 5427 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

differentiation a fourier transform in frequency

Hi forum,

With a window h, and its fourier transform H. How do I calculate the differentiation of H in frequency? (ie. the derivative of H)

Are the values of H’ simply the delta value of the consecutive bins of H?
ie. H’[1] = H[1] = H[0], H’[2] = H[2] - H[1], H’[k] = H[k] - H[k-1]

ps. in case you wonder why I need to do this. I need to calculate the fft of nh(n), which would be the differentiation of H

Thanks in advance!

differentiation a fourier transform in frequency

Reply #1
Are the values of H’ simply the delta value of the consecutive bins of H?
ie. H’[1] = H[1] = H[0], H’[2] = H[2] - H[1], H’[k] = H[k] - H[k-1]


Yes, although keep in mind that differentiation numerically will amplify noise.

ps. in case you wonder why I need to do this. I need to calculate the fft of nh(n), which would be the differentiation of H


If this is being done numerically, I would just directly multiply those two arrays and then take the FFT.  This will also avoid the annoying issue of diff() reducing the length of your vector by one. 

differentiation a fourier transform in frequency

Reply #2
Hi! Saratoga

thanks for the reply!! I forgot to mention, n*h(n), n is a variable, which is the frame/sample index of the current signal. In that case I'll need to calculate the fft of n*h(n) for each frame, which would be too costly for real-time processing.

Is there any other way to avoid amplifying noise?

Besides, you also mentioned about the issue with diff() which reduces the length by one, does it happen at the end of the array? ie. H'[last_index] = 0

Thank you!!

Are the values of H’ simply the delta value of the consecutive bins of H?
ie. H’[1] = H[1] = H[0], H’[2] = H[2] - H[1], H’[k] = H[k] - H[k-1]


Yes, although keep in mind that differentiation numerically will amplify noise.

ps. in case you wonder why I need to do this. I need to calculate the fft of nh(n), which would be the differentiation of H


If this is being done numerically, I would just directly multiply those two arrays and then take the FFT.  This will also avoid the annoying issue of diff() reducing the length of your vector by one.

differentiation a fourier transform in frequency

Reply #3
thanks for the reply!! I forgot to mention, n*h(n), n is a variable, which is the frame/sample index of the current signal. In that case I'll need to calculate the fft of n*h(n) for each frame, which would be too costly for real-time processing.


How is what you are proposing any faster?

differentiation a fourier transform in frequency

Reply #4
For the derivative of H, I only need to calculate H' once and cache the values for future usage.

But if I want to calculate fft(n* h(n)), that means for each frame (ie. for n = start frame to end frame), I'll need to calculate fft(current_frame_index(h(current_frame_index)). Or am I getting you wrong?

Thanks!

differentiation a fourier transform in frequency

Reply #5
In either case you still have to do 1 FFT per frame, so I don't see any savings.

differentiation a fourier transform in frequency

Reply #6
In case I cache the values of H', there will be no FFT involved when calculating short term spectrum

What I am really doing is to calculate the 'spectral motif' of a sinusoid with a linearly varying amplitude. If the analysis window is h(n), the weighted function would be x(n) =  h(n) * (A + Bn) = A * h(n) + B* n* h(n) => A being the original amplitude, B being the factor for linear transformation over each frames (ie. frame[n] = frame[n- 1] + B).

X(w) = fft(x(n)) = A* H(w) + B * H'(w).

If I cache the values of H and H', I can get the signal at any frame by ifft(X(w)). there should be no need to perform fft per frame.

I hope it's making the motivation a bit clearer?

In either case you still have to do 1 FFT per frame, so I don't see any savings.