interpolate_signal applies different interpolation algorithms to the input multi-channel signal to fill in the missing samples and harmonizes the sampling rate.

interpolate_signal(
df,
method = "spline_natural",
sr = 100,
st = NULL,
et = NULL
)

## Arguments

df dataframe. Input multi-channel accelerometer signal. string. Interpolation algorithms. Could be "spline_natural", "spline_improved" or "spline_fmm": see splinefun; and "linear": see approxfun. Default is "spline_natural". number. Sampling rate in Hz of the output signal. Default is 100. POSIXct date. The start time for interpolation. If it is NULL, it will use the start time of the input signal. Default is NULL. POSIXct date. The end time for interpolation. If it is NULL, it will use the end time of the input signal. Default is NULL.

## Value

dataframe. Interpolated signal.

## How is it used in MIMS-unit algorithm?

This function is a utility function that has been used in functions: extrapolate, and simulate_new_data.

Other utility functions: clip_data(), cut_off_signal(), parse_epoch_string(), sampling_rate(), segment_data(), simulate_new_data()

## Examples

  # Use sample data
df = sample_raw_accel_data

# Plot input
illustrate_signal(df, plot_maxed_out_line=FALSE)

# Interpolate to 100 Hz
sr = 100

# Interpolate the entire sequence of data
output = interpolate_signal(df, sr=sr)

# Plot output
illustrate_signal(output, plot_maxed_out_line=FALSE)

# Interpolate part of the sequence
output = interpolate_signal(df, sr=sr, st=df[10,1], et=df[100,1])

# Plot output
illustrate_signal(output, plot_maxed_out_line=FALSE)