calc_shifted_emg_response: Time-shift a signal given by its FFT and compute the IFFT.

View source: R/simulate_model.r

calc_shifted_emg_responseR Documentation

Time-shift a signal given by its FFT and compute the IFFT.

Description

Take FFT values of a signal, perform a small time-shift on it and compute the inverse FFT.

Usage

calc_shifted_emg_response(firing_response_fft, time_shift, sampling)

Arguments

firing_response_fft

FFT values of a signal, computed at the frequencies given by sampling$fft_freqs.

time_shift

Amount of time by which the signal should be shifted in time. Must be zero or positive and smaller than one sampling interval.

sampling

An object providing information on the sampling paramters chosen. Usually constructed by the function create_sampling.

Value

A real, numerical vector of length sampling$NFFT.

Note

Requires the underlying signal to be purely real and thus the FFT to be hermitian.

Examples

set.seed(1)
t <- seq(0.1, 1, 0.1)
y <- sin(2*pi*t)
resp <- semg.simulatr:::calc_shifted_emg_response(
    firing_response_fft = fft(y) / length(y), 1/20,
    sampling = semg.simulatr:::create_sampling(Fs = 10, NFFT = 10))
dev.new()
plot(t, resp)
points(t, y, col="red")


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