botto <b.otto <at> uke.uni-hamburg.de> writes: > > here is a practical problem we would like to solve. In a pneumatic post the > acceleration of the capsule is measured and plotted over time. From the > graph achieved we would like to derive some kind of statistic value that > describes the stress the capsule, or what is in it, is exhibited to. > .. > > 1) Apply a fourier transformation to the acceleration profile to > > 2) get a number of harmonic waves describing my graph > > 3) and use the amplitudes of my waves in a weighted fashion to > calculate some statistical value. > > What I tried to do is: > > A) construct an artificial profile fg for testing purpose like > > a. f1 <- function(x) 0.5*sin(3*x + pi) .... > > X) in my test example I can define the amount of harmonic components, > because here I know that number. Of course afterwards in my natural profiles > I won't know. > > Y) I have to transform the values I get out of the "fft" and "fourier" > functions to estimate the frequency, amplitude and phase of my harmonics. >
Check function spectrum in stats which also has some methods to provide smoothed plots. There is also package signal which I have not tried. And don't expect too much of phase plots, I have seen generations of students jumping on these to explain the universum, the EEG and US politics because it sound so mysterious, and never seen a working method coming out of it. It would have been good if you had provided a real example series because then it would have been possible to tell you if you could find a reasonable estimate of the "true" frequency and acceleration. In general, when you have only very few oscillations, you get a seemingly lousy estimate, which is only the consequence of how fft is defined as a rather broad-minded model. If you are sure that there is a single frequency with harmonics, other methods such as cyclic gams or even cyclic nlme (see the oestrus example in that package) might provide better results. Dieter ______________________________________________ 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.