# Re: [R] Stuck with FFT

From: Rthoughts <seb.brockel_at_northampton.ac.uk>
Date: Tue, 18 Nov 2008 01:42:39 -0800 (PST)

Hi,

I have more questions about the fft. The application in Excel is very limited.

In Excel I can adjust graphs and calibrate the x and y-axis. The input and process, however, is limited compared to R.

With a Dataset table where one column is the hour difference and the second are the values with hidden frequencies, how is it possible to plot a frequency spectrum with the x-axis calibrated to the hour difference where the left should be infinite frequency and half way to the right should be the midpoint.

Below is an example dataset with a 24 hour sinusoid that I would like to fft for assisting with my ability to interpret my output. How do I calibrate the plot so that the x-axis displays the cycles per that run and the y-axis is frequency? In the command line, (Dataset\$X10, inverse = FALSE, frequency = 24), what does the frequency line specify and and it is related to number of data points? By doing this am I generating frequencies rather than revealing them?

Secondly, how to do generate a spectrogram on R? I believe that this one is where the x-axis is the cycles per data point with the left being infinite cycles to 0.5 being one cylce per 2 data points and the y-axis is the amplitude.

Thank you very much in advance if you can help and share your experience/ knowledge. I am progressing with fourier transforms in my research but I am new to it so that doesn't help.

Thirdly, I came across in my reading that it is a good idea to generate a correlogram to determine if it is valid to do an fft on the dataset. How would I go about doing this and how is frequency/ lag determined?

```00/01 00:00	4.330
00/01 01:00	3.536
00/01 02:00	2.500
00/01 03:00	1.294
00/01 04:00	0.000
00/01 05:00	-1.294
00/01 06:00	-2.500
00/01 07:00	-3.536
00/01 08:00	-4.330
00/01 09:00	-4.830
00/01 10:00	-5.000
00/01 11:00	-4.830
00/01 12:00	-4.330
00/01 13:00	-3.536
00/01 14:00	-2.500
00/01 15:00	-1.294
00/01 16:00	0.000
00/01 17:00	1.294
00/01 18:00	2.500
00/01 19:00	3.536
00/01 20:00	4.330
00/01 21:00	4.830
00/01 22:00	5.000
00/01 23:00	4.830
01/01 00:00	4.330
01/01 01:00	3.536
01/01 02:00	2.500
01/01 03:00	1.294
01/01 04:00	0.000
01/01 05:00	-1.294
01/01 06:00	-2.500
01/01 07:00	-3.536
01/01 08:00	-4.330
01/01 09:00	-4.830
01/01 10:00	-5.000
01/01 11:00	-4.830
01/01 12:00	-4.330
01/01 13:00	-3.536
01/01 14:00	-2.500
01/01 15:00	-1.294
01/01 16:00	0.000
01/01 17:00	1.294
01/01 18:00	2.500
01/01 19:00	3.536
01/01 20:00	4.330
01/01 21:00	4.830
01/01 22:00	5.000
01/01 23:00	4.830
02/01 00:00	4.330
02/01 01:00	3.536
02/01 02:00	2.500
02/01 03:00	1.294
02/01 04:00	0.000
02/01 05:00	-1.294
02/01 06:00	-2.500
02/01 07:00	-3.536
02/01 08:00	-4.330
02/01 09:00	-4.830
02/01 10:00	-5.000
02/01 11:00	-4.830
02/01 12:00	-4.330
02/01 13:00	-3.536
02/01 14:00	-2.500
02/01 15:00	-1.294
02/01 16:00	0.000
02/01 17:00	1.294
02/01 18:00	2.500
02/01 19:00	3.536
02/01 20:00	4.330
02/01 21:00	4.830
02/01 22:00	5.000
02/01 23:00	4.830
03/01 00:00	4.330
03/01 01:00	3.536
03/01 02:00	2.500
03/01 03:00	1.294
03/01 04:00	0.000
03/01 05:00	-1.294
03/01 06:00	-2.500
03/01 07:00	-3.536
03/01 08:00	-4.330
03/01 09:00	-4.830
03/01 10:00	-5.000
03/01 11:00	-4.830
03/01 12:00	-4.330
03/01 13:00	-3.536
03/01 14:00	-2.500
03/01 15:00	-1.294
03/01 16:00	0.000
03/01 17:00	1.294
03/01 18:00	2.500
03/01 19:00	3.536
03/01 20:00	4.330
03/01 21:00	4.830
03/01 22:00	5.000
03/01 23:00	4.830
```
```--
View this message in context: http://www.nabble.com/Stuck-with-FFT-tp20192942p20556317.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
```
Received on Tue 18 Nov 2008 - 10:21:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 18 Nov 2008 - 10:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.