INPUT:n2(10,5,40,1),n3(5,5,20,1);
VARIABLE:波峰=0,波谷=0,小波峰=0,小波谷=0;
前锋:=ref(波峰,1);
前谷:=ref(波谷,1);
前小峰:=ref(小波峰,1);
前小谷:=ref(小波谷,1);
if h>=ref(hhv(h,n2),1) and h>=refx(hhv(h,n2),n2) then
波峰:=h;
else 波峰:=前锋;
if l<=ref(llv(l,n2),1) and l<=refx(llv(l,n2),n2) then
波谷:=l;
else 波谷:=前谷;
if h>=ref(hhv(h,n2),1) and h>=refx(hhv(h,n3),n3) then
小波峰:=h;
else 小波峰:=前小峰;
if l<=ref(llv(l,n2),1) and l<=refx(llv(l,n3),n3) then
小波谷:=l;
else 小波谷:=前小谷;