1 Aug 2006 01:43
questions regarding spline functions
Dylan Beaudette <dylan.beaudette <at> gmail.com>
2006-07-31 23:43:10 GMT
2006-07-31 23:43:10 GMT
Greetings,
A couple general questions regarding the use of splines to interpolate depth
profile data.
Here is an example of a set of depths, with associated attributes for a given
soil profile, along with a function for calculating midpoints from a set of
soil horizon boundaries:
#calculate midpoints:
mid <- function(x) {
for( i in 1:length(x)) {
if( i > 1) {
a[i] = (x[i] - x[i-1]) / 2 + x[i-1]
}
}
#reurn the results
a[which(!is.na(a))]
}
#horizon depth bounds
z <- c(0,2,18,24,68,160,170,192,200)
#horizon midpoints, associated with horizon attribute
x <- mid(z)
#clay pct
y <- c(0,1,2,2,4,7,6,1)
#plot them
(Continue reading)
RSS Feed