Find peaks in data without using signal processing tool
100 次查看(过去 30 天)
显示 更早的评论
Hello Guys,
I am working on a set of data, attached.
I am using MatlabR2021b, I don't have signal processing tool. Therefore can't use peak function.
I need to find:
- Total number of peaks in data
- What are the corresponding values of eack peak
Would appreciate if anyone can suggest a solution.
Please let me know if my question is not clear.
Thanks
0 个评论
采纳的回答
Star Strider
2022-7-8
The findpeaks function is in the Signal Processing Toolbox, and since you do not have access to it, use the core MATLAB islocalmax function instead (introduced in R2017b) —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1059360/peaktest.xlsx', 'VariableNamingRule','preserve');
Time = T1.Time;
spike2 = T1.spike2;
Lv = islocalmax(spike2, 'MinProminence',1); % Choose The Name-Value Pair Arguments To Return The Peaks You Want
TotalNrOfPeaks = nnz(Lv)
PeakTable = table(Time(Lv),spike2(Lv), 'VariableNames',{'Spike2Time','Spike2Amplitude'})
figure
plot(Time, spike2)
hold on
plot(Time(Lv), spike2(Lv), '^r')
hold off
grid
.
0 个评论
更多回答(1 个)
Sam Chak
2022-7-8
If the data is not too large, you can test features of the findpeaks() function in this forum.
[data] = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1059360/peaktest.xlsx');
plot(data.Time, data.spike2)
[pks, locs] = findpeaks(data.spike2)
num_of_pks = length(pks)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!