Hello greetings to everyone

I have a damping sine curve (code and data attached) as the following

and I intend to do the following action on it, and make an envelope like the dashed curve:

How can I plot these max and min and plot a fit envelope like the dashed curve as above in MATLAB (The crosses are the midpoint of each line on which they are located)

Thanks in advance for your time given on this question and stay healthy

## Best Answer