[R] FFT, frequs, magnitudes, phases

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Aug 19 14:16:42 CEST 2005


Wolfgang Waser <wolfgang.waser at rz.hu-berlin.de> writes:

> Hi,
> 
> I'm in dire need of a fast fourier transformation for me stupid biologist, 
> i.e. I have a heartbeat signal and would like to decompose it into pure sin 
> waves, getting three vectors, one containing the frequencies of the sin 
> waves, one the magnitudes and one the phases (that's what I get from my data 
> acquisition software's FFT function).
> I'd be very much obliged, if someone could point out which command would do 
> the job in R.

fft(), but notice that it gives the complex transform. You need to do
a little homework to get at the magnitude/phase values. (Basically,
you just have to take Mod() and Arg(), but there some conventions
about the frequencies and multipliers that one can get wrong).

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list