Obtain Envelope

You can do it using a Hilbert transform, like so:

using DSP, Plots
x = 0:0.1:200
y = sin.(x) .+ sin.(1.2x)
env = abs.(hilbert(y))
plot(x, y)
plot!(x, env)
plot!(x, -env)

image

9 Likes