Info
此问题已关闭。 请重新打开它进行编辑或回答。
Use findpeaks function for latency assessment
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to use the findpeaks function to measure the latency of my trigger signal (first channel) and my sound signal (second channel). The problem is that, particularly for my second channel, there are loads of peaks (there are trains of five vowels). I only need the x value of the first initial small peak of each vowel train as this would be the onset of the sound which I would need to compare to the trigger latency.
I know that the first small peak occurs approximately every 1000 miliseconds and I tried to insert 1000 as MinPeakDistance but I get this error message:
Error using findpeaks
Expected MinPeakDistance to be a scalar with value < 0.999994.
Error in findpeaks>parse_inputs (line 339)
validateattributes(Pd,{'numeric'},{'real','scalar','nonempty','nonnegative','<',x(M)-x(1)},'findpeaks','MinPeakDistance');
Error in findpeaks (line 136)
= parse_inputs(isInMATLAB,Yin,varargin{:});
I dont understand why MinPeakDistance needs to be less than 0.99. Does anybody know an alternative solution for this?
Thank you!
%% Select sample of recording for visualisation
Sample = 160000
SecondChS = SecondCh(1:Sample,:);
FirstChS = FirstCh(1:Sample,:)
XS = NewX(1:Sample);
%%Top plot
nexttile
plot(XS,FirstChS)
title('First Channel')
%Bottom plot
nexttile
plot(XS,SecondChS)
title('Second Channel')
[pks,locs] = findpeaks(SecondChS,Sample,'MinPeakProminence',0.01,'Annotate','extents','MinPeakDistance',1000);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/993315/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/993320/image.png)
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!