我有一个加速计数据,即AccX,AccY和AccZ。
我正在寻找一种算法来根据这些数据计算功率谱密度。我知道以下内容:
library(caret)
library(nlme)
data(Orthodont)
head(Orthodont)
subjects <- as.character(unique(Orthodont$Subject))
## figure out folds at the subject level
set.seed(134)
sub_folds <- createFolds(y = subjects, list = TRUE, returnTrain = TRUE)
## now create the mappings to which *rows* are in the training set
## based on which subjects are left in or out
in_train <- holdout <- vector(mode = "list", length = length(sub_folds))
row_index <- 1:nrow(Orthodont)
for(i in seq(along = sub_folds)) {
## Which subjects are in fold i
sub_in <- subjects[sub_folds[[i]]]
## which rows of the data correspond to those subjects
in_train[[i]] <- row_index[Orthodont$Subject %in% sub_in]
holdout[[i]] <- row_index[!(Orthodont$Subject %in% sub_in)]
}
names(in_train) <- names(holdout) <- names(sub_folds)
ctrl <- trainControl(method = "cv",
savePredictions = TRUE,
index = in_train,
indexOut = holdout)
mod <- train(distance ~ (age+Sex)^2, data = Orthodont,
method = "lm",
trControl = ctrl)
first_fold <- subset(mod$pred, Resample == "Fold01")
## These were used to fit the model
table(Orthodont$Subject[-first_fold$rowIndex])
## These were heldout:
table(Orthodont$Subject[first_fold$rowIndex])
其中&#34; s&#34;是输入信号,fft是快速傅立叶变换。
F = fft (s);
我需要知道这个PSD = (1/length(s)) * F * conj(F);
是加速时间序列还是位置时间序列?
答案 0 :(得分:0)
这取决于您感兴趣的内容。如果您想要加速时间序列的功率谱密度,那么s
必须是加速时间序列本身而不是位置时间序列。
但请注意,基于您编写的简单算法(称为&#34;周期图&#34;)的PSD估计在许多情况下可能不足以获得真实PSD的实际估计。
话题很多,文献广泛。你可以从Wikipedia开始,或者,如果你想要一本关于好(但相当艰难)的书的建议,Percival and Walden。为了提供更详细的信息,我们需要从物理角度更详细地了解您必须做的事情。