library(musclesyneRgies)
For example, one can measure the full width at half maximum (FWHM) of the motor primitives or their centre of activity (CoA).
# Load a typical motor primitive of 30 cycles (from locomotion)
data("primitive")
# Reduce primitive to the first cycle
<- primitive$signal[1:which(primitive$time == max(primitive$time))[1]]
prim_sub
# Calculate FWHM of the first cycle
<- FWHM(prim_sub)
prim_sub_FWHM # Calculate CoA of the first cycle
<- CoA(prim_sub)
prim_sub_CoA
# Half maximum (for the plots)
<- min(prim_sub) + (max(prim_sub) - min(prim_sub)) / 2
hm <- prim_sub
hm_plot which(hm_plot > hm)] <- hm
hm_plot[which(hm_plot < hm)] <- NA
hm_plot[
# Plots
plot(prim_sub, ty = "l", xlab = "Time", ylab = "Amplitude")
lines(hm_plot, lwd = 3, col = 2) # FWHM (horizontal, in red)
::abline(v = prim_sub_CoA, lwd = 3, col = 4) # CoA (vertical, in blue) graphics
Or perhaps one might want to investigate the nonlinear behaviour of a long primitive.
<- primitive$signal
prim
# Calculate the local complexity or Higuchi's fractal dimension (HFD)
<- HFD(prim)$Higuchi
nonlin_HFD # Calculate the local complexity or Hurst exponent (H)
<- Hurst(prim, min_win = max(primitive$time))$Hurst
nonlin_H
message("Higuchi's fractal dimension: ", round(nonlin_HFD, 3))
#> Higuchi's fractal dimension: 1.047
message("Hurst exponent: ", round(nonlin_H, 3))
#> Hurst exponent: 0.338