开发者

Rebuilding original signal from frequencies, amplitude, and phase obtained after doing an fft

开发者 https://www.devze.com 2023-03-09 17:50 出处:网络
Rebuilding original signal from frequencies, amplitude, and phase obtained after doing an fft. Greetings

Rebuilding original signal from frequencies, amplitude, and phase obtained after doing an fft.

Greetings

I'm trying to rebuild a signal from the frequency, amplitude, and phase obtained after I do an fft of a signal, but when I try and combine the fft data (frequency, amplitude, and phase) back to see if I get a similar signal, the pattern is a little off. I think it has to do with my formula which may be a little incorrect.

The formula I'm using to combine the data is:

amplitude*sin(2*pi*time*frequency+phase)+amplitude*cos(2*pi*time*frequency+phase);

Please note: At the moment I don't want to use IFFT due to the fact that I will be editing the amplitude and frequencies before the calculations are done

An image of the plot is below. The top one is the original signal and the bottom one is the signal created with the equation. If you want t开发者_开发技巧o know I'm using matlab but I think the problem is with the equation.

Rebuilding original signal from frequencies, amplitude, and phase obtained after doing an fft

tia


The IFFT is an efficient implementation of the following transformation:

       N-1
x[n] = SUM X[k] exp(j*2*pi*n*k/N)
       k=0

where X[k] are your FFT results (complex amplitudes), and x[n] are your time-domain samples. For real-only inputs, this can be rewritten in terms of cos and sin (or in terms of cos with a phase term), but it's usually easier just to stick with the complex representation.

[This can be heavily vectorised, but I'll leave that up to you!]


I don't see why you want both a sin and a cos term in your equation: this should do it...

amplitude*sin(2*pi*time*frequency+phase);

Using both sin and cosine terms will, unless there is something odd about the FFT, cause scaling issues and a phase shift. However I do not know if that would explain the distortion you've seen. That may be due to something to do with the FFT block sizes you have used.

0

精彩评论

暂无评论...
验证码 换一张
取 消