[R] average waveform over many cycles

2007-10-10 Thread Bill Simpson
I have 400 cycles of a noisy waveform. I would like to find the average (over the 400 cycles) of one cycle. Please tell me to do it in R. Any suggestions welcome! Thanks very much for any help. Bill __ R-help@r-project.org mailing list

Re: [R] average waveform over many cycles

2007-10-10 Thread Jim Lemon
Bill Simpson wrote: I have 400 cycles of a noisy waveform. I would like to find the average (over the 400 cycles) of one cycle. Please tell me to do it in R. Any suggestions welcome! Hi Bill, I recently had to do something like this for an approach to target curve. The steps were: 1) Create

Re: [R] average waveform over many cycles

2007-10-10 Thread Bill Simpson
Thanks Jim for the help. I forgot to say that one of my main snags is figuring how how to chop up the one long (44100 samples) vector into pieces (400 of them). This is my C-inspired way of thinking but there must be a better way in R. cyclelength=44100/400 for i= 1 to 400 for j= 1 to

Re: [R] average waveform over many cycles

2007-10-10 Thread jim holtman
try: y - matrix(x, ncol=400, byrow=TRUE) On 10/10/07, Bill Simpson [EMAIL PROTECTED] wrote: Thanks Jim for the help. I forgot to say that one of my main snags is figuring how how to chop up the one long (44100 samples) vector into pieces (400 of them). This is my C-inspired way of thinking

Re: [R] average waveform over many cycles

2007-10-10 Thread Moshe Olshansky
Hi Bill, You get cyclelemgth = 110. If this is true, i.e if every 110 points of data represent an entire cycle then everything is all right, but are you sure this is true? Think what happens if the true cycle length was 110.5 data points. Regards, Moshe. --- Bill Simpson [EMAIL PROTECTED]