R function "spectrum" expects a time series as input. I have attached a compressed archive with two detrended and denoised signals (txt format) whose spectra I would like to compare. I start out trying to generate a multivariate time series. Please, notice the different signals length. Moreover, R command "cbind" forces a matrix with number of rows equal to the longer of the two signals, padding the shorter one by replicating it from its start values.... What happens in the frequency domain ? The signals are sampled at 30 Hz.
> s10146 <- read.table("10146-Clean-Signal.txt") > s45533 <- read.table("45533-Clean-Signal.txt") > v10146 <- as.vector(s10146[,1]) > length(v10146) [1] 8133 > v45533 <- as.vector(s45533[,1]) > length(v45533) [1] 6764 > xx <-cbind(v10146, v45533) > dim(xx) [1] 8133 2 > v45533[1:10] [1] -1.7721546 -1.7482835 -1.6964711 -1.6154405 -1.5045701 -1.3747449 [7] -1.2332980 -1.0912172 -0.9585821 -0.8420886 > xx[6760:6770,] v10146 v45533 [1,] -0.8585375 -0.6076069 [2,] -0.8060065 -0.5288312 [3,] -0.7541174 -0.4447711 [4,] -0.7028816 -0.3592778 [5,] -0.6524279 -0.2767786 [6,] -0.6027233 -1.7721546 # start replicating shorter signal [7,] -0.5536868 -1.7482835 [8,] -0.5052780 -1.6964711 [9,] -0.4574095 -1.6154405 [10,] -0.4097922 -1.5045701 [11,] -0.3623641 -1.3747449 > twosig <- ts(xx,deltat=0.033,start=0) # time series On Sun, May 4, 2008 at 2:14 PM, stephen sefick <[EMAIL PROTECTED]> wrote: > is this a problem? are there error messages? if so could you provide > them. Try > as.matrix(yourdata). One thing you could do is create a moving average > that reduces the signals to the lowest common denominator. Could you > provide reproducable code with maybe a toy data set so anybody could have a > look at what is going on. > good luck > > Stephen > > >
______________________________________________ R-help@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.