I am modeling and interference measurement and want to find the number of fringes that cross a detector. The data is fairly dense and it causes problems in findpeaks, and I was trying to use parfor to speed it up. Of course parfor doesn't exist in octave, so I was wondering the best way to handle this issue.
This is what I tried initially;
```
parfor i = 1:N
start = round(((i-1)/N)*length(IT))+1;
stop = round((i/N)*length(IT));
partime = time(start:stop);
[row,col] = findpeaks(IT(start:stop)./max(IT(start:stop))); % Fringe Frequency
pklk = [pklk partime(col)];
end
```
Here is an implementation of
findpeaksusing regex:That returns the positions of the peaks. Use it as:
The Octave implementation of
findpeaksusesbsxfunto expand the index vector that requiren^2memory.UPDATE
Two more options
heightanddistare added. Moreover the function now has two outputs:pkslocal maxima andlocspeak locations.