Package 'LMD'

Title: A Self-Adaptive Approach for Demodulating Multi-Component Signal
Description: Local Mean Decomposition is an iterative and self-adaptive approach for demodulating, processing, and analyzing multi-component amplitude modulated and frequency modulated signals. This R package is based on the approach suggested by Smith (2005) <doi:10.1098/rsif.2005.0058> and the 'Python' library 'PyLMD'.
Authors: Shubhra Prakash [trl, aut, cre]
Maintainer: Shubhra Prakash <[email protected]>
License: Apache License (>= 2)
Version: 1.1.0
Built: 2025-03-10 05:06:07 UTC
Source: https://github.com/shubhra-opensource/lmd

Help Index


Extract Product Function

Description

Method for extracting product functions

Usage

extract_product_function(
  signal,
  max_envelope_iteration = 200,
  envelope_epsilon = 0.01,
  convergence_epsilon = 0.01
)

Arguments

signal

Signal values (Numeric | vector)

max_envelope_iteration

Maximum number of iterations when separating local envelope signals (Integer)

envelope_epsilon

Terminate processing when obtaining pure FM signal (Double)

convergence_epsilon

Terminate processing when modulation signal converges (Double)

Value

Product Function

Author(s)

Shubhra Prakash, [email protected]

References

https://pypi.org/project/PyLMD/

Examples

x=1:100
y = (2 / 3 )* sin(x * 30) + (2 / 3) * sin(x * 17.5) + (4 / 5) *cos(x * 2)
plot(y,type="l")
pf=extract_product_function(y)

Find Extreme Points

Description

Method for finding Extreme Points

Usage

find_extrema(signal, include_endpoints = TRUE)

Arguments

signal

Signal values (Numeric | vector)

include_endpoints

whether to include end points or not (Boolean)

Details

A local extrema is the point at which a maximum or minimum value of the function in some open interval containing the point is obtained.

Value

Indexes of all extrema values (including starting and ending points)

Author(s)

Shubhra Prakash, [email protected]

Examples

signal=c( 0.841471 ,0.9092974,0.14112,-0.7568025,-0.9589243)
find_extrema(signal)

Monotonicity Check

Description

Method for checking if signal is increasing or decreasing monotonously

Usage

is_monotonous(signal)

Arguments

signal

Signal values (Numeric | vector)

Details

A monotonic signal is a function that keeps increasing or decreasing as its domain variable proceeds.#'

Value

Boolean

Author(s)

Shubhra Prakash, [email protected]

References

https://pypi.org/project/PyLMD/

Examples

x=1:100
is_monotonous(x)

Local Mean Decomposition

Description

Method for finding Product Functions (PFs)

Usage

lmd(
  signal,
  include_endpoints = TRUE,
  max_smooth_iteration = 12,
  max_envelope_iteration = 200,
  envelope_epsilon = 0.01,
  convergence_epsilon = 0.01,
  max_num_pf = 8
)

Arguments

signal

Signal values (Numeric | vector)

include_endpoints

Whether to treat the endpoint of the signal as a pseudo-extreme point (Boolean)

max_smooth_iteration

Maximum number of iterations of moving average algorithm (Integer)

max_envelope_iteration

Maximum number of iterations when separating local envelope signals (Integer)

envelope_epsilon

Terminate processing when obtaining pure FM signal (Double)

convergence_epsilon

Terminate processing when modulation signal converges (Double)

max_num_pf

The maximum number of PFs generated(Integer)

Details

LMD is a method of decomposing signal into Product Functions (PFs) based on algorithm presented in Jonathan S. Smith. The local mean decomposition and its application to EEG perception data. Journal of the Royal Society Interface, 2005, 2(5):443-454

Value

list(pf,residue) | PFs:The decompose functions arranged from high frequency to low frequency | residue:residual component

Author(s)

Shubhra Prakash, [email protected]

References

https://pypi.org/project/PyLMD/

Examples

x=1:100
y = (2 / 3 )* sin(x * 30) + (2 / 3) * sin(x * 17.5) + (4 / 5) *cos(x * 2)
plot(y,type="l")
lmd(y)

LMD Shiny

Description

Shiny Dashboard for plotting Product Functions (PFs) and Residue

Usage

lmd_shiny()

Author(s)

Shubhra Prakash, [email protected]


Local Mean and Envelope

Description

Method for finding Local Mean and Envelope

Usage

local_mean_and_envelope(signal, extrema)

Arguments

signal

Signal values (Numeric | vector)

extrema

indexes for extreme values

Value

mean, envelope and smoothed mean and envelope values

Author(s)

Shubhra Prakash, [email protected]

References

https://pypi.org/project/PyLMD/

Examples

signal = sin(1:10)
extrema = c(1 , 2,  5,  8, 10)
local_mean_and_envelope(signal, extrema)

Weighted Moving Average

Description

Weighted Moving Average Smoothing

Usage

moving_average_smooth(signal, window, max_smooth_iteration = 12)

Arguments

signal

Signal values (Numeric | vector)

window

filter weights for smoothing (Numeric | vector)

max_smooth_iteration

Maximum number of iterations of moving average algorithm (Integer)

Details

Weighted Moving Average Smoothing is used to smooth en the mean and envelope signal

Value

smooth signal

Author(s)

Shubhra Prakash, [email protected]

References

https://pypi.org/project/PyLMD/

Examples

x=0:100
y = (2 / 3 )* sin(x * 30) + (2 / 3) * sin(x * 17.5) + (4 / 5) *cos(x * 2)
plot(y,type="l")
wma=moving_average_smooth(y,5)
plot(wma,type="l")

LMD Plot

Description

Method for plotting Product Functions (PFs) and Residue

Usage

plot_lmd(
  lmd_obj,
  max_pf = length(lmd_obj[["pf"]]),
  show_residue = TRUE,
  pricolor_plot = "midnightblue",
  line_size_plot = 1
)

Arguments

lmd_obj

LMD object created from LMD function

max_pf

Number of PFs to Plot

show_residue

Whether to plot residue or not

pricolor_plot

color of plots

line_size_plot

Size of line in ggplot

Value

ggplot plot for Product Functions (PFs) and Residue

Author(s)

Shubhra Prakash, [email protected]

Examples

x=1:100
y = (2 / 3 )* sin(x * 30) + (2 / 3) * sin(x * 17.5) + (4 / 5) *cos(x * 2)
plot_lmd(lmd(y))