Learn R Programming

ifultools (version 2.0-26)

mutilsSDF: SDF evaluation over a discrete uniform grid of frequencies

Description

MUTILS is a C library used for certain itCall functions. This function evaluates an input SDF function over frequencies on the interval [0, Nyquist], i.e., normalized frequencies [0, 1/2].

Usage

mutilsSDF(sdf=NULL, sdfargs=NULL, n.freq=1024, sampling.interval=1)

Value

a numeric vector containing the values of the input SDF evaluated over frequencies uniformly distributed on the interval [0, Nyquist]. The corresponding frequencies are assigned to the output object as the named attribute "frequency". If sdf=NULL, a negative numeric scalar is returned and serves as a flag to MUTILS C code that the SDF is missing or undefined.

Arguments

n.freq

a positive integer (greater than one) defining the number of frequencies to use in evaluating the SDF. The frequencies are uniformly distributed over the interval [0, Nyquist] ala f=[0, 1/P , 2/P, 3/P, ..., (n.freq-1)/P] where P=2*(n.freq-1)/sampling.interval. Default: 1024.

sampling.interval

a positive numeric scalar representing the sampling interval of the time series associated with the input SDF. This argument is used only develop the set of frequencies over which the input SDF is evaluated (see documentation for n.freq argument for more details). Default: 1.

sdf

the input SDF. If sdf=NULL, a negative numeric scalar is returned and serves as a flag the MUTILS C code to ignore relevant SDF calculations. Otherwise, this input must be a function whose first argument is f (representing frequency). At a minimum, the SDF must be defined over frequencies [0, Nyquist] where Nyquist=1/(2*sampling.interval). Additional arguments that are needed to calculate the SDF should be passed via the sdfargs parameter. Default: NULL.

sdfargs

a list of named additional SDF arguments. For example, if the input SDF requires additional arguments (other than f): y and z, then specify this input ala sdfargs=list(y=1, z=pi). Default: NULL (no additional inputs).

See Also

mutilsDistanceMetric, mutilsFilterType, mutilsFilterTypeContinuous, mutilsTransformPeakType, mutilsTransformType, mutilsWSShrinkageFunction, mutilsWSThresholdFunction.

Examples

Run this code
## create a faux SDF 
S <- function(f, phi)  1/(1 + phi^2 - 2*phi*cos(2*pi*f))

## specify additional input arguments needed to 
## evaluate the SDF 
sdfargs <- list(phi=0.9)

## evaluate the SDF over frequencies on the 
## interval [0, 1/2] 
Sx <- mutilsSDF(sdf=S, sdfargs=sdfargs)

## plot the result 
f <- attr(Sx,"frequency")
plot(f, Sx, type="l")

Run the code above in your browser using DataLab