The finding or searching the local peak is needed for some application such as fundamental frequency estimation, finding time delay or timelag or others. The following is a simple program to find the local peak of signal. The example of .wav sound signal
To give the display and find the rough peak of signal you can see from the figures of signal. The picture below comparing whole signal and the local signal from 1 to 4000 samples. To find the coordinate of local peak, just simply type
[a b]=max(signal(1:4000)
octave:1> [signal, fs] =wavread('signal.wav'); % read signal octave:2> threshold=0.1; % limit the min. peak amplitude octave for sig_ind = 1:4000 > if signal(sig_ind) > threshold > x=sig_ind; > break; > endif > endfor octave:3> x x = 3822
To give the display and find the rough peak of signal you can see from the figures of signal. The picture below comparing whole signal and the local signal from 1 to 4000 samples. To find the coordinate of local peak, just simply type
[a b]=max(signal(1:4000)
Full length signal and signal from 1 to 4000 samples |