Jump to content
  • Advertisement
Sign in to follow this  
staticVoid2

Fourier Transform questions

This topic is 2472 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been implementing a (Discrete) Fourier transform (and it's inverse) in C++ and was wondering about two things in particular,

1. How does e^-i (negative) differ from e^i when representing this using Euler's formula?

I know that anything to the power of a negative value is it's reciprocal (e.g. 2^-1 = 1/2) but I'm a bit confused whether this changes the Euler's formula (cos(w) + isin(w)) or not.

and

2. Why does the inverse Fourier transform get normalized at the end (i.e sum/numsamples) whereas the normal Fourier transform does not?

Share this post


Link to post
Share on other sites
Advertisement

I've been implementing a (Discrete) Fourier transform (and it's inverse) in C++ and was wondering about two things in particular,

1. How does e^-i (negative) differ from e^i when representing this using Euler's formula?

I know that anything to the power of a negative value is it's reciprocal (e.g. 2^-1 = 1/2) but I'm a bit confused whether this changes the Euler's formula (cos(w) + isin(w)) or not.

e^-i = e^(-1)i = cos(-1) + isin(-1) = cos(1) - isin(1)
e^i = e^(1)i = cos(1) + isin(1)

and

2. Why does the inverse Fourier transform get normalized at the end (i.e sum/numsamples) whereas the normal Fourier transform does not?


Which one gets normalized is a convention. You could multiply the normal one instead of dividing the inverse one. The reason you have to do it is (vaguely) because when going from time domain to frequency domain your "unit of measure" changes from s to rad/s.

Share this post


Link to post
Share on other sites

I know that anything to the power of a negative value is it's reciprocal (e.g. 2^-1 = 1/2) but I'm a bit confused whether this changes the Euler's formula (cos(w) + isin(w)) or not.


Barsiwek has answered your questions, but I just wanted to elaborate a little on this point.

Euler's formula gives exp(ia) = cos(a) + i * sin(a), and exp(-ia) is the reciprocal of exp(ia), so

exp(-ia) = 1 / (cos(a) + i * sin(a))

But mostly we don't like having imaginary numbers in the denominator so you can use this little trick,

exp(-ia) = (1 / (cos(a) + i * sin(a))) * ((cos(a) - i * sin(a)) / (cos(a) - i * sin(a))

where the new term is the compliment of cos(a) + i * sin(a) over itself, i.e. it is one. But now if we multiply through

exp(-ia) = (cos(a) - i * sin(a)) / (cos^2(a) + sin^2(a))

and since cos^2(a) + sin^2(a) = 1,

exp(-ia) = cos(a) - i * sin(a).

So, just using Euler's formula you can see that taking the reciprocal also works (as it should).

-Josh

Share this post


Link to post
Share on other sites
Thanks for your replies.

So if e^-i is cos(w) - isin(w) does this mean you just negate the imaginary part?

I'm filtering the signal in the frequency domain to blur the image and it seems to be working but after looking at the code I've realized that I'm not
accounting for the e^-i at all. The fourier transform and it's inverse seem to be practically identical apart from the normalization part I perform in the inverse.


Edit:

Ok, A problem I was having was that the image was transposed on output. I changed cos(w) + isin(w) to cos(w) - isin(w) by negating the imaginary part (in the forward fourier transform) and it seems to be outputting correctly now. I take it all I had to do was negate this imaginary part?

Share this post


Link to post
Share on other sites

Thanks for your replies.

So if e^-i is cos(w) - isin(w) does this mean you just negate the imaginary part?

That should be e^(-iw). And yes, it does mean that, but you can deduce it yourself from Euler's identity and the fact that sin(-x) = -sin(x). You can answer most questions in Math yourself, and you should try to get in the habit of doing that.

Share this post


Link to post
Share on other sites
What is confusing me even more now is that my lecture has given me this definition of a Fourier transform:


fourier1.gif


and on Wikipedia it has it as:


fourier2.gif

And the inverse transforms are pretty much these two again switched around and they are integrating with respect to omega. Which one is correct?

Share this post


Link to post
Share on other sites
It's a matter of convention, and I believe different fields use different conventions.

I think applying the 1/(2*pi) scale during the inverse transform is more common. I have even see people using 1/sqrt(2*pi) in front of both, thus making the transform and its inverse only differ by the sign in front of "iwt". All these options only differ in scale and perhaps one complex conjugation, so it's no big deal.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!