How to get and plot a signal envelope
<p>I would like to know if there is a function <code>envelope</code> in Python to have the same result as this </p>

<p><img src="https://i.stack.imgur.com/o0bhO.png" alt="picture">  </p>

<p>I have already tried an <code>envelope</code> function in Python but there is this result and it doesn't correspond with what I want.</p>

<p><img src="https://i.stack.imgur.com/jInGg.jpg" alt="result"> </p>