| TransferFunction {spacesRGB} | R Documentation |
Constructing and Testing TransferFunction Objects
Description
The function TransferFunction() is the constructor for TransferFunction objects.
is.TransferFunction() tests whether an object is a valid TransferFunction object.
as.TransferFunction() converts other variables to a TransferFunction object,
and is designed to be overridden by other packages.
Usage
TransferFunction( fun, funinv, domain, range, id=NULL )
is.TransferFunction(x)
## Default S3 method:
as.TransferFunction( ... )
Arguments
fun |
a function that accepts a numeric argument, and returns one of the same length.
The dimension of |
funinv |
a function that the inverse for |
domain |
a 2xN matrix, or a numeric vector that can be converted to such a matrix, by column.
In each column, the entry in row 1 must be strictly less than the entry in row 2.
The columns of |
range |
a 2xN matrix, or a numeric vector that can be converted to such a matrix, by column.
The N here must be equal to the N for |
id |
a character string that is helpful when printing the object, and in logging messages.
If |
x |
an R object to test for being a valid TransferFunction object. |
... |
arguments for use in other packages. |
Details
If fun is univariate, then it must be able to accept a numeric vector of any length,
and apply the function to each number in the vector; i.e. fun must be vectorized.
If a number in the vector is NA, then the function must silently return NA for that number;
usually this is not a problem.
The function is *not* required to test whether the number is in the domain interval;
this is handled by the TransferFunction code.
If fun is multivariate with dimension N, then it must be able to accept a vector
of length N and return a vector of length N.
It is *not* required to accept an MxN matrix.
It is *not* required to test whether the vector is in the domain box.
The function funinv has the same requirements as fun.
Value
TransferFunction() returns a TransferFunction object, or NULL in case of ERROR.
is.TransferFunction() returns TRUE or FALSE.
It only checks the class, using base::inherits().
as.TransferFunction.default() issues an ERROR message and returns NULL..
See Also
dimension(),
composition(),
is.invertible(),
metadata(),
inverse(),
transfer(),
orientation(),
validate(),
print.TransferFunction(),
plot.TransferFunction()
Examples
# make a test TransferFunction
myfun = function(x) {x*x}
test = TransferFunction( myfun, sqrt, domain=c(0,3), range=c(0,9), id='test.TF' )
# print it
test
#-------------------- test.TF ---------------------#
## test.TF is a univariate TransferFunction.
## domain: [0,3] (x)
## range: [0,9] (y)
## invertible: Yes
## orientation: preserving
## range-test points = 1300, max(distance)=0.
## validation: Passed
# and now plot it
plot( test )