Other signal processing methods are available in StructuralVibration.jl.
1 Detrending
Detrending is the process of removing trends from a signal. This is useful when you want to analyze the fluctuations around a trend. The detrend function can be used to remove linear or polynomial trends from a signal.
1.1 API
detrend
detrend(t, y, order = 1, bp = [])
Detrend a signal y with respect to time t using a polynomial of order order.
Inputs
t: Time vector
y: Signal to be detrended
order: Order of the polynomial (default is 1)
bp: Breakpoints for the polynomial (default is empty)
Output
y_detrended: Detrended signal
Notes
order can be a vector if the trend is different over the segments defined by the breakpoints bp.
The breakpoints bp are the points where the polynomial order changes. If bp is empty, a single polynomial is fitted to the entire signal.
The gradient of a signal is the rate of change of the signal with respect to time. Julia [] has a lot of packages for computing the gradient of a signal. The gradient function in StructuralVibration.jl is a simple helper function built around the gradient function in Interpolations.jl.
Being based on interpolation, gradient is not robust against noise. For robust gradient estimation, you can compute the gradient of the signal denoised by the denoising function by using one of the numerous Julia differentiation packages if the signal is smooth enough (at least class \(C^\2\)). If the latter condition is not satisfied, you can for instance use NoiseRobustDifferentiation.jl, which implements the Total variation regularized numerical differentiation method1 .
Footnotes
R. Chartrand. “Numerical differentiation of noisy, nonsmooth data”. ISRN Applied Mathematics, vol. 2011, 164564, 2011.↩︎