Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道您可以使用 approx 函数进行线性插值。但是,我在任何地方都找不到如何对这对点进行分段线性插值。例如,假设 x<-c(1,4,3,2) y<-c(4,3,2,1)
有人可以给我答案吗?非常感谢提前
我不确定您指的是什么“点对”。但是您可以approx()在您提供的一对向量上使用该函数。
approx()
x <- c(1, 4, 3, 2) y <- c(4, 3, 2, 1) interp <- approx(x, y) plot(x, y, pch=16, cex=2) points(interp, col="red")