setup_sampling: Set up tranfer function sampling

View source: R/sampling.r

setup_samplingR Documentation

Set up tranfer function sampling

Description

Determine the frequencies at which the transfer functions are to be sampled.

Usage

setup_sampling(
  muscles,
  f_target,
  psi_length,
  max_freq_dom_sample_dist = Inf,
  unsampled_firings = TRUE
)

Arguments

muscles

A data.frame containing muscles as typically created by convert_muscle_list_to_df.

f_target

The temporal sampling frequency in Hz that is desired for the final output.

psi_length

The length of the relevant (non-zero) section of the function psi, that represents the shape of the IAP. This is relevant since it influences the length of the firing response of a MU.

max_freq_dom_sample_dist

If given (unit is Hz), specifies an upper bound on the allowed distance between two sampled points in the frequency domain. This is achieved by adjusting NFFT accordingly.

Details

Uses information on the motor units to obtain an estimate for the maximum length of a MU firing response. This in turn defines - for given sampling frequency - the number of samples that needs to be computed for each firing response. And thus the number of points to be computed for the inverse FFT is defined.

Value

A "sampling" object with members "Fs", "NFFT", "fft_freqs" and "freqs_to_calc". All frequencies are in Hz.

Note

This function will always choose an odd NFFT since even NFFTs lead to spectra that - when inverse transformed - yield non-zero imaginary parts in the resulting time signal. This is due to the presence of the single frequency coefficient at Fs/2. This coefficient is required to be purely real for purely real time domain signals. This can not be guaranteed, however, when the coefficient stems from the evaluation of analytical expressions for the fourier transform, as it is the case here. By choosing NFFT to be odd, we circumvent this problem as then the frequency bin at Fs/2 is simply not present.


ime-luebeck/semgsim documentation built on April 14, 2022, 11:02 p.m.