Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gebhardt, Albrecht
akima
Commits
4ec7cb75
Commit
4ec7cb75
authored
Feb 02, 2006
by
agebhard
Browse files
add last changes from Martin Maechler
ready for release as 0.5-1
parent
840a8ad1
Changes
4
Show whitespace changes
Inline
Side-by-side
INDEX
View file @
4ec7cb75
...
...
@@ -3,5 +3,5 @@ akima Waveform Distortion Data for Bivariate
aspline Univariate Akima interpolation
interp Gridded Bivariate Interpolation for Irregular
Data
interpp Pointwise Bivariate Interpolation for
Irregular
Data
interpp Pointwise Bivariate Interpolation for
Irregular
Data
R/interp.new.R
View file @
4ec7cb75
...
...
@@ -7,18 +7,14 @@ interp.new <-
if
(
!
(
all
(
is.finite
(
x
))
&&
all
(
is.finite
(
y
))
&&
all
(
is.finite
(
z
))))
stop
(
"missing values and Infs not allowed"
)
if
(
!
is.null
(
ncp
))
{
if
(
ncp
!=
0
)
{
cat
(
"ncp not supported, it is automatically choosen by Fortran code\n"
)
}
else
{
cat
(
"linear interpolation not yet implemented with interp.new().\n"
)
stop
(
"use interp.old()."
)
}
}
if
(
linear
)
{
cat
(
"linear interpolation not yet implemented with interp.new().\n"
)
stop
(
"use interp.old()."
)
if
(
ncp
!=
0
)
warning
(
"'ncp' not supported, it is automatically choosen by Fortran code\n"
)
else
linear
<-
TRUE
}
if
(
linear
)
stop
(
"linear interpolation not implemented in interp.new().\n"
,
"use 'interp()' (or 'interp.old()')."
)
drx
<-
diff
(
range
(
x
))
dry
<-
diff
(
range
(
y
))
...
...
man/interp.Rd
View file @
4ec7cb75
...
...
@@ -107,8 +107,9 @@ interp.new(x, y, z, xo = seq(min(x), max(x), length = 40),
possible, but is deprecated.
The resulting structure is suitable for input to the
functions \code{contour} and \code{image}. Check the requirements of
these functions when choosing values for \code{xo} and \code{yo}.
functions \code{\link{contour}} and \code{\link{image}}. Check
the requirements of these functions when choosing values for
\code{xo} and \code{yo}.
}
\details{
If \code{linear} is \code{TRUE} (default), linear
...
...
@@ -125,26 +126,23 @@ interp.new(x, y, z, xo = seq(min(x), max(x), length = 40),
user defined function).
The triangulation scheme used by \code{interp} works well if \code{x}
and \code{y} have
similar scales but will appear stretched if they have very different
scales. The spreads of \code{x} and \code{y} must be within four
orders of magnitude of each other for \code{interp} to work.
and \code{y} have similar scales but will appear stretched if they have
very different scales. The spreads of \code{x} and \code{y} must be
within four orders of magnitude of each other for \code{interp} to work.
}
\references{
Akima, H. (1978). A Method of Bivariate Interpolation and
Smooth Surface Fitting for Irregularly Distributed Data Points.
ACM Transactions on Mathematical Software,
\bold{4}, 148-164.
ACM Transactions on Mathematical Software \bold{4}, 148-164.
Akima, H. (1996). Algorithm 761: scattered-data surface fitting that has
the accuracy of a cubic polynomial.
ACM Transactions on Mathematical Software,
\bold{22}, 362--371
ACM Transactions on Mathematical Software \bold{22}, 362--371.
}
\seealso{
\code{\link{contour}}, \code{\link{image}},
\code{\link{approx}}, \code{\link{spline}},
\code{\link{aspline}},
\code{\link{outer}}, \code{\link{expand.grid}}.
}
\examples{
...
...
@@ -162,8 +160,8 @@ points (akima, pch = 3)
akima.smooth <-
with(akima, interp(x, y, z, xo=seq(0,25, length=100),
yo=seq(0,20, length=100)))
image (akima.smooth)
contour(akima.smooth, add
=
TRUE)
image (akima.smooth
, main = "interp(<akima data>, *) on finer grid"
)
contour(akima.smooth, add
=
TRUE
, col = "thistle"
)
points(akima, pch = 3, cex = 2, col = "blue")
# use triangulation package to show underlying triangulation:
if(library(tripack, logical.return=TRUE))
...
...
@@ -171,9 +169,9 @@ if(library(tripack, logical.return=TRUE))
# use only 15 points (interpolation only within convex hull!)
akima.part <- with(akima, interp(x[1:15], y[1:15], z[1:15]))
image (akima.part)
image (akima.part
, "interp() on subset of only 15 points"
)
contour(akima.part, add=TRUE)
points(akima$x[1:15],akima$y[1:15])
points(akima$x[1:15],akima$y[1:15]
, col = "blue"
)
## spline interpolation, two variants (AMS 526 "Old", AMS 761 "New")
## -----------------------------------------------------------------
...
...
@@ -184,7 +182,7 @@ table(is.na(akima.sO$z)) ## 3990 NA's; = 40 \%
akima.sO <- with(akima,
interp.old(x,y,z, xo=seq(0,25, length=100), yo=seq(0,20, len=100), ncp = 4))
sum(is.na(akima.sO$z)) ## still 3429
image (akima.sO
) #
almost useless
image (akima.sO
, main = "interp.old(*, ncp = 4) [
almost useless
]")
contour(akima.sO, add = TRUE)
## "New:"
...
...
@@ -195,7 +193,8 @@ akima.spl <- with(akima, interp(x,y,z, xo=seq(0,25, length=100),
yo=seq(0,20, length=100),
linear=FALSE))
contour(akima.spl) ; points(akima)
contour(akima.spl, main = "smooth interp(*, linear = FALSE)")
points(akima)
full.pal <- function(n) hcl(h = seq(340, 20, length = n))
cool.pal <- function(n) hcl(h = seq(120, 0, length = n) + 150)
...
...
@@ -203,6 +202,7 @@ warm.pal <- function(n) hcl(h = seq(120, 0, length = n) - 30)
filled.contour(akima.spl, color.palette = full.pal,
plot.axes = { axis(1); axis(2);
title("smooth interp(*, linear = FALSE");
points(akima, pch = 3, col= hcl(c=100, l = 20))})
# no extrapolation!
...
...
man/interpp.Rd
View file @
4ec7cb75
...
...
@@ -120,7 +120,10 @@ dupfun = NULL, ncp)
\bold{22}, 362-371.
}
\seealso{
\code{\link[base]{contour}}, \code{\link[base]{image}}, \code{\link[base]{approx}}, \code{\link[base]{spline}}, \code{\link[base]{outer}}, \code{\link[base]{expand.grid}},\code{\link{interp}}.
\code{\link[base]{contour}}, \code{\link[base]{image}},
\code{\link[base]{approx}}, \code{\link[base]{spline}},
\code{\link[base]{outer}}, \code{\link[base]{expand.grid}},
\code{\link{interp}}, \code{\link{aspline}}.
}
\examples{
data(akima)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment