forked from albertmundu/miscellaneous
-
Notifications
You must be signed in to change notification settings - Fork 0
/
psuedo.extrema
32 lines (30 loc) · 1.25 KB
/
psuedo.extrema
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'''
@Description: Finding Local Maxima and Local Minima using variable window size for given (x,y) coordinates of waveform
@Author: Albert Mundu, Anant Goel, Bhumil Sarvaiya
'''
1. Take window size N
2. Find the local Maxima(lmax) & Minima(lmin) in the window N
3. Compare middle value M of the window N with the lmax & lmin
a. If M equals lmax and M.x equals lmax.x
i. store M in listMax
ii. update lmax=M
b. Else if M equals lmin and M.x equals lmin.x
i. store M in listMin
ii. update lmin=M
c. Else
i. Shift the window
4. Check whether lmax or lmin is out of window N due to shifting
a. If True in case lmax;
i. Find lmax for the window N
ii. If lmin greater than equal to newly added value V.
update lmin=V
b. Else If True in case lmin;
i. Find lmin for the window N
ii. If lmax is less than equal to the newly added value V
update lmax=V
c. Else compare lmax & lmin with the newly added value in the window N after shifting by 1
i. If lmax less than equal to the newly added value V
update lmax=V
ii. Else if lmin greater than equal to the newly added value V
update lmin=V
5. Repeat Step 3