MATLAB: Finding peak pressure value.

data acquisitiongenetic algorithmImage Processing Toolboximage segmentationSignal Processing Toolbox

Hello. Would you mind if you could assist me in my algorithm I did. I have to find every peak values generated randomly from walking patterns. For example I have subject one walk for certain amount of time, and I'm having sampling rate 100 samples per second. However the subject may take longer or less than the periodicity of sampling rate, however that is fine – this is not the issue. But my algorithm which is slop base, is not efficiently working to find every peak – Not the local maxima please. The txt file has numbers of one big vectors (say 1X3000 number) and reading row by row. Thank you so much in advance.
x=load('girl_1.txt');
tmax= length(x) ;
x4 = x(1:5:end);
t1_n = 1:5:tmax;
x1_n_ref=0;
k=0;
for i=1:length(t1_n)
if x4(i)>140
if x1_n_ref-x4(i)<0
x1_n_ref=x4(i);
alpha=1;
elseif alpha==1 && x1_n_ref-x4(i)>0
k=k+1;
peak(k)=x1_n_ref;
peak_time(k) = t1_n(i);
alpha=2;
end
else
x1_n_ref=0;
end
end
figure(1) hold on grid plot(t1_n, x4,'b');

Best Answer

You forgot to attach 'girl_1.txt' so we can't try anything. Anyway, to find the peaks, what if you just use findpeaks()? Or else threshold and useregionprops() to find the weight centroid of each peak.