-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathR_code_mFPCA.R
61 lines (41 loc) · 1.72 KB
/
R_code_mFPCA.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
###############################################################POD30
start_time <- Sys.time()
library(fdapace)
library(R.matlab)
path <- system.file("mat-files", package = "R.matlab")
pathname <- file.path(path, "all_condition_filed210914_POD30.mat")
data <- readMat(pathname)
data_set<-data[["force.allcondition"]]
tt = seq(1, 12000, by=1)
M = 12000
N = 35
L3 <- MakeFPCAInputs(IDs = rep(1:N, each=M), tVec=rep(tt,N), t(data_set))
FPCAdense2 <- FPCA(L3$Ly, L3$Lt, optns = list(useBinnedData='OFF'))
loworder_force_phi = FPCAdense2$phi
filename <- paste("loworder_force_phi_POD30", ".mat", sep = "")
writeMat(filename, forceFPCAbasis = loworder_force_phi)
filename <- paste("loworder_force_mean_POD30", ".mat", sep = "")
writeMat(filename, forcemean = FPCAdense2$mu)
FPCAdense2$cumFVE
plot(FPCAdense2)
#############################################################################
library(fdapace)
library(R.matlab)
path <- system.file("mat-files", package = "R.matlab")
pathname <- file.path(path, "all_condition_filed210914_POD30.mat")
data <- readMat(pathname)
data_set<-data[["displacement.allcondition"]]
tt = seq(1, 12000, by=1)
M = 12000
N = 35
L3 <- MakeFPCAInputs(IDs = rep(1:N, each=M), tVec=rep(tt,N), t(data_set))
FPCAdense2 <- FPCA(L3$Ly, L3$Lt, optns = list(useBinnedData='OFF'))
loworder_displacement_phi = FPCAdense2$phi
filename <- paste("loworder_displacement_phi_POD30", ".mat", sep = "")
writeMat(filename, displacementFPCAbasis = loworder_displacement_phi)
filename <- paste("loworder_displacement_mean_POD30", ".mat", sep = "")
writeMat(filename, displacementmean = FPCAdense2$mu)
FPCAdense2$cumFVE
plot(FPCAdense2)
end_time <- Sys.time()
start_time-end_time