我尝试过这个答案
但这并没有真正帮助。 我想在 XYZ 数据帧上执行 TPS(使用 Fields{} 中的 Tps),其中 xy 是坐标,z 是厚度。然后我想首先在 TPS 之前可视化情节,然后在 TPS 之后可视化..?这可能吗。 然后我想提取给定的一组新 xy 坐标的预测厚度..?
如果可行,请告诉我
我的数据框看起来像这样,数据框称为LSP:
time PART MEAS PARTSUB XLOC YLOC
xxxx 1 1.956 a -3465 -94350
xxxx 1 1.962 a -3465 -53850
xxxx 1 1.951 a 50435 -40350
xxxx 1 1.958 a -57365 -40350
所以我尝试了这个:
LSP.spline <- Tps(LSP[,5:6], LSP$MEAS)
out.p <- predict.surface(LSP.spline, xy = c(1,2))
plot.surface(out.p, type="p")
但是 out.p 只是 NULL..?
所以尝试情节给了我:
Error in nrow(z) : argument "z" is missing, with no default
感谢任何帮助。 保罗。
最佳答案
predict.surface
现在是一个过时/已弃用的函数。请改用 predictSurface
。
fit<- Tps( BD[,1:4], BD$lnya) # fit surface to data
# evaluate fitted surface for first two
# variables holding other two fixed at median values
out.p<- predictSurface(fit)
surface(out.p, type="C")
Thanks for that - how about my second question....how can I extract predicted surface thickness values for a given set of XY locations..?
使用预测
函数。阅读 ?predict.Tps
。对于上面的例子,假设我们想要预测 BD[, 1:4]
中的前 4 个位置,我们可以这样做
predict(fit, x = BD[1:4, 1:4])
# [,1]
#[1,] 11.804124
#[2,] 11.804124
#[3,] 8.069056
#[4,] 9.501551
一般来说,传递x
一个两列矩阵。
关于r - R 中用于 3D 表面预测的薄板样条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40528507/