algorithm of envelope function 'peak' option

5 Ansichten (letzte 30 Tage)
준영
준영 am 24 Jan. 2025
Kommentiert: Walter Roberson am 7 Feb. 2025
Hello,
I'm using the envelope function with 'peak' option, [yupper,ylower] = envelope(x,np,'peak').
The description says, 'The envelopes are determined using spline interpolation over local maxima separated by at least np samples.'
I'm wondering that what order is used in the spline interpolation and also how the local maxima are calculated, separated by 'at least' np samples.
If I can, I would like to know the algorithm too.
Thank you.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 24 Jan. 2025
The local maxima are found using findpeaks() with the 'MinPeakDistance' option
spline interpolation is done using interp1() with the 'spline' option. interp1 defines
"Requires at least 4 points, falling back to linear or quadratic interpolation if 2 or 3 points are supplied, respectively" which implies that it is normally cubic spline.
  2 Kommentare
준영
준영 am 7 Feb. 2025
Thank you for your reply.
I have one more question.
Where can we find such used codes if we want to know how the matlab function works?
Thank you very much.
Walter Roberson
Walter Roberson am 7 Feb. 2025
Sometimes you can just (for example)
edit envelope
It happens that source code for envelope is available.
Sometimes you need to use something like
which envelope(1:10, 2, 'peak')
in order to find out which specific method is being selected when envelope(1:10, 2, 'peak') is being called. After you which() has produced an answer, you can edit the method indicated.
But sometimes you encounter situations such as
which dictionary
that will reply back
dictionary is a built-in method % dictionary constructor
and if you encounter such a situation, you will be unable to view the source code, as it is written in C++ or C or FORTRAN and is not available.
Occasionally you will encounter code being implemented in .p files. There is (deliberately) no documented method of viewing .p files.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by