[R] fft inverse display help

Dieter Menne dieter.menne at menne-biomed.de
Thu Oct 2 08:48:48 CEST 2008


 <rkevinburton <at> charter.net> writes:

> 
> ff <- complex(length(fs))
> ff[9] <- fs[9]
> ff[5] <- fs[5]
> 
> Include the DC component:
> 
> ff[1] <- fs[1]
> 
> Take the inverse
> 
> fi <- fft(ff, inverse=TRUE) / length(ff)
> 
> Plot
> 
> plot(fi)
> 
> Notice that the plot is the Re vs. Im on the x and y axis' respectively.

In one case, you plot a complex vector (gives points in complex plane), in the
other case a time series, where default assumption with a warning is to plot the
real part only.

Try 

plot(as.ts(fi))

and you see the latter, where implicitely plot.ts is called.

Dieter



More information about the R-help mailing list