Open MinhChauNGUYEN opened 5 years ago
Good idea.
An overhaul is under way. This request has been integrated to the project for version 1.1. The various possibilities for f0 will be proposed first, and Oq calculated later.
This is a preview. Colour codes are just a first try.
Another example, using the 1st token in the gallery:
% Method 1 (max DECPA): green. plot(f0(:,1), 'LineStyle','-', 'LineWidth', 1.5, 'Marker', 'o','Color', [.0863 .7216 .3059], 'MarkerSize',10, 'MarkerFaceColor', [.0863 .7216 .3059]) % Method 2 (first peak): red. plot(f0(:,2), 'LineStyle','-', 'LineWidth', 0.5, 'Marker', 'o','Color', 'red', 'MarkerSize',2, 'MarkerFaceColor', 'red') % Method 3 (last peak): black. plot(f0(:,3), 'LineStyle','-', 'LineWidth', 0.5, 'Marker', 'p','Color', 'black', 'MarkerSize',2, 'MarkerFaceColor', 'black') % Method 4 (barycentre): blue diamonds. plot(f0(:,4),'db','MarkerSize',13) % Method 5 (most salient pulse on 2nd derivative): orange. plot(f0(:,5), 'LineStyle','--', 'Marker', 's','Color', [1 .7961 .3765], 'MarkerSize',9) % Method 6: excluding double peaks plot(f0(:,6), 'dg','MarkerSize',8)
The f0 matrix now has six columns instead of just one.
152.5952 152.4685 154.6121 153.2593 152.4685 0
124.9292 124.9752 124.9752 124.9752 124.9752 124.9292
118.5484 118.6536 118.6536 118.6536 118.6536 118.5484
113.6598 113.6774 113.6774 113.6774 113.6774 113.6598
108.0882 107.8319 107.8319 107.8319 107.8319 108.0882
103.5211 103.5819 101.5684 102.9636 103.5819 0
101.6129 101.6738 102.4081 102.1598 101.6738 0
98.6577 98.6754 98.9255 98.6820 98.6754 0
91.4938 94.0118 93.9357 94.1008 94.0118 0
86.6405 86.9068 87.0337 86.9052 86.9068 0
82.5843 82.1443 82.7361 82.1488 82.1443 0
73.6227 74.0417 74.0417 74.0417 74.0417 73.6227
75.5137 73.6227 73.0725 73.6000 73.6227 0
74.4932 74.5235 74.0542 74.4988 74.5235 0
75.0000 74.9860 76.0542 75.0345 74.9860 0
67.3282 67.2687 67.2687 67.2687 67.2687 67.3282
65.4303 65.5012 65.5012 65.5012 65.5012 65.4303
73.2558 73.2558 73.2558 73.2558 73.2558 73.2558
83.3648 83.3160 83.3160 83.3160 83.3160 83.3648
88.7324 88.7842 88.7842 88.7842 88.7842 88.7324
90.9278 91.1402 91.1402 91.1402 91.1402 90.9278
95.2484 94.9940 94.9940 94.9940 94.9940 95.2484
93.8298 97.4499 97.4499 97.4499 97.4499 93.8298
104.0094 99.9207 99.9207 99.9207 99.9207 104.0094
86.8110 86.8127 86.8127 86.8127 86.8127 86.8110
147.0000 146.7163 146.7163 146.7163 146.7163 147.0000
Like the opening peaks, the closing peak can be imprecise and there are various different types which shouldn't be treated by the same method. Therefore, in the part that peakdet asks for user's verification of f0 (besides resetting the threshold, or suppressing the initial or final cycles), the choice of selecting other method to handle multiple peaks shoud be offered here. User can type >>0 for 'selecting the highest among the peaks'; >>1 for 'selecting the first peak', etc. The f0 and oq values after that will be re-caculated according to the new method which is more suitable.