Count peaks in a data set

Hello,
I have a set of data of volumes in the lungs by mechanical ventilation. I want to count the peaks in this data to devide the total volume by this value to get the tidal volumes. How can I get this out of a set of data? We have very much data, so our script is like this:
files=dir('*.log');
M=NaN(length(files),1);
Lek=M;
B=M;
C=M;
R=M;
PS=M;
TV=M;
for i=1:length(files)
out=textscan(files(i).name,'M%f_Lek%f_B%f_C%f_R%f_PS%f');
A = readcell(files(i).name); %data inladen
Z = string(A);
time = Z(7:end,1); %van time een vector maken
time = strrep(time, ',', '.'); %komma's in vector in punten veranderen
time = str2double(time);
flow = Z(7:end,2);
flow= strrep(flow, ',', '.');
flow = str2double(flow);
flow = flow./60;
flowpos = flow;
flow(flow<0)= 0;
RR=23;
volpos = trapz(time, flow);
TV(i)= (volpos./RR);
TV(i)= TV(i).*1000;
M(i)=out{1};
Lek(i)=out{2};
B(i)=out{3};
C(i)=out{4};
R(i)=out{5};
PS(i)=out{6};
end
T=table(M,Lek,B,C,R,PS,TV,'VariableNames',{'M','Lek','B','C','R','PS','TV'})
Because the tidal volumes vary a lot, I want to get a function which looks at the other values and not set a fixed treshold. Can anyone help me with this?

2 件のコメント

Adam
Adam 2019 年 5 月 28 日
If you have the Signal Processing Toolbox
doc findpeaks
gives you various options to specify how to define what counts as a significant peak.
Will Reeves
Will Reeves 2022 年 7 月 14 日
編集済み: Will Reeves 2022 年 7 月 14 日
.. and if you don't? :-) (have the signal processing toolbox)

サインインしてコメントする。

回答 (1 件)

Steven Lord
Steven Lord 2022 年 7 月 14 日

0 投票

Take a look at the islocalmax function in MATLAB.

カテゴリ

質問済み:

2019 年 5 月 28 日

回答済み:

2022 年 7 月 14 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by