[R] Stuck with FFT

stephen sefick ssefick at gmail.com
Tue Oct 28 15:40:12 CET 2008


#look at dput this is an easy way to share
#data or another great way is to make a
#fake data series
x <- (c(105L, 115L, 140L, 180L, 230L, 300L, 360L, 418L, 450L, 480L,
495L, 500L, 495L, 480L, 450L, 410L, 360L, 300L, 230L, 180L, 140L,
115L, 105L, 100L, 105L, 115L, 140L, 180L, 230L, 300L, 360L, 410L,
450L, 480L, 495L, 500L, 495L, 480L, 450L, 410L, 360L, 300L, 230L,
180L, 140L, 115L, 105L, 100L))

#time series with a frequency with 24 hours making one day
y<-ts(x, frequency=24, start=0)

plot(y)

#frequency domain plot of fft (spectrogram)
specturm(y)

On Tue, Oct 28, 2008 at 6:04 AM, Rthoughts
<seb.brockel at northampton.ac.uk> wrote:
>
> EDIT: to assist you to assist me in turn, for which I am grateful, more
> detail than the below needs to be provided.
>
> I open tables and view them using Rcmdr so they become active datasets. I am
> assuming that x101, x100, etc, are column headings because when the dataset
> is edited they can be changed in numerical or non-numerical values. Lets
> assume I change those column headings to VB! and V2, and I would like the
> output to appear in V3. V2 contains the values to be fft'd. These are
> practise values of 24h length sinusoids thus if a sinusoid is viewed as a
> frequency value and the time-series are hourly values where periodicity, not
> amplitude, counts, this is a 24hr frequency time-series fo hourly values.
>
> Here's an example table (to keep it simple, there are 2 columns, V1 for the
> 24h frequency values, and V2 for fft output, I don not understand the fft
> function enough yet if V1 should contain date/ time values and if V2 should
> contain the array, and V3 the output values);
>
> The table name, I assume, since it appears in the window border and taskbar,
> is 'Dataset'.
>
>   V1     V2
> 1 105
> 2 115
> 3 140
> 4 180
> 5 230
> 6 300
> 7 360
> 8 418
> 9 450
> 10 480
> 11 495
> 12 500
> 13 495
> 14 480
> 15 450
> 16 410
> 17 360
> 18 300
> 19 230
> 20 180
> 21 140
> 22 115
> 23 105
> 24 100
> 25 105
> 26 115
> 27 140
> 28 180
> 29 230
> 30 300
> 31 360
> 32 410
> 33 450
> 34 480
> 35 495
> 36 500
> 37 495
> 38 480
> 39 450
> 40 410
> 41 360
> 42 300
> 43 230
> 44 180
> 45 140
> 46 115
> 47 105
> 48 100
>
> This is open as a table by view command. How do I go about fft'ing this?
>
> If I can do this I can then in turn try to analyse my real radon data which
> are hourly time-series (thus is a disctrete and periodic array). I have to
> analyse it for periodicities that can be attributed to 24hr and 24.8hr tidal
> cycles to confirm the substance of the first aim of my research.
>
> Secondly, how can I view the output as a graph? I am expecting a frequency
> domain from the time domain, thus a frequency of a certain amplitude should
> be produced.
>
> Thank you very much. I hope this clears the matter up a bit. If not, I am
> happy to provide more details.
>
>
>
>
>
> Rthoughts wrote:
>>
>> Dear all,
>>
>> Before I can get into serious Fourier analysis of Radon time-series I am
>> practising with 24hour and 24.8hour sinusoids to assist with my
>> interpretation of signals ittributed to tidal input to Radon time series.
>>
>> I am stuck. I have tried researching this to no avail. I am awating a book
>> that should describe fourier transforms in detail and another one that
>> should discuss the R application.
>>
>> I know what the command line is but I can't get it to refer to the array.
>>
>> What is 'z'? If I have a table open entitled '24hsinusoids' with date/
>> time column by the hour from January 01 2008 00:00 to January 02 2011
>> 00:00 (X01.06.2008) (time column listed as X00:00) with corresponding
>> sinudoidal signal value column (X100) to give a complete curve for 24hours
>> spread as curves over the whole time-span, how can I fft from this table?
>>
>> fft(z, inverse = FALSE) gives me as; object 'z' not found.
>>
>> Please help and explain how R recognises the table and does fft's from it.
>> The time-series is discrete and periodic (or should be, as I need to
>> analyse my Radon time-series fro exactly this and I am very stuck now).
>>
>> Thank you with all my heart if you can help.
>>
>
> --
> View this message in context: http://www.nabble.com/Stuck-with-FFT-tp20192942p20204314.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.
>



-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis



More information about the R-help mailing list