four1
hello
i have a little question about the use of the four1 subroutine. i want to implement the sub to my programm.
as a start i took a gaussian (real no imag part) as input and would expect to get another gaussian as output.
unfortunately the output is not an gaussian but would become one after taking the absolute value or squared.
does any body know anything about this issue?
thanks for your help
as nobody is answering i tend to feel really sad.:(
i was thinking i should be more precise about the problem i have.
so once again. i am tryin to explain an would appreciate any assistance.
i am trying to implement a fouriertransformation to a program i am writing and started out with the code four1 from the numerical recipes.
although i am just going to transform some real function right now, for later use i would like to have the option of transforming complex functions also.
i generate a input array of the function i would like to transform, setting the imag part zero, call the subroutine and everything is fine and the progs running. i did the rearrangement of the output file accordingly to the book.
but i cant understand the data i get.
at first i generated a gaussian as input looking forward to get another gaussian as output. thats what should happen if one solved the transform analytically.
but what i get is somehow simillar to a gaussian but the sign is switching with every second data point.
after that i tried to use a simple sin wave with several oszillation as input and would expect to get one delta peak at the frequency of the oszillation.
again what i get is not what i would suspect but two antisymmetrical peaks.
as i understood the rules of symmetry for the two domains the real and odd sin wave in time domain should be imaginary and odd in frequ domain.
so that is true for the output. but how do i get from there to the single peak which one would expect.
what did i do wrong?
do i have to do some more rearrangement of the output data? or is the reason for my misunderstanding of the process deeper in theory and i would have to take the product of H and H* to get the transform of the simple real function.
i am happy about any hint and help i can get.
thanks alot
eduard
04-19-2007, 04:27 AM
Hi,
If you look at your first post, you already have the answer to your problem. The output of the FFT is NOT the power spectrum of your input data but the fourier transform of your data. You get the power spectrum (and with that the frequency content) of your data by taking the absolute value of your complex FFT. Maybe you should have a look at some literature about fourier transform for further reading.
Best greets,
eduard
i am aware of that thanks.
but shouldn t the transformation of a gaussian still be a gaussian? you can solve this one analytical and have a look.
as quite a lot of people watch the post but nobody feels the need to provide any help nor assistance nor hint where to look in the book, i am wondering wether people dont understand my problem or nobody else ever run into this, or the worst case, my problem being so trivial that everybody might think its all there in chapter 12 just read it stup and stop wasting our precious time and space here.
you are right. its there in the discussion of twoft and realft.
its just not explicitly stated in a step by step way but hidden in formulation.
from a didactic point of view its quite poor.
just in case this is meant to be a textbook for people to learn about programming numerical procedures one might think it might be written in a comprehensible way making it possible to be understood.
it should not be composed for the authors to show off or readers who already know about the topics discussed there to find affirmation of their skills and feel so clever while reading known stuff.
so i finally figured out how to do it right but thanks for the help anyway.