MATLAB Answers

x for y is?

2 views (last 30 days)
jop schilder
jop schilder on 24 Feb 2020
Commented: jop schilder on 24 Feb 2020
my data is a table of 17439x3. With the lines being: time, displacement and force, respectively.
I Need all the corresponding values for time and displacement at the peak forces.
my code is
[pks] = findpeaks (-M2B{:,3},'MinPeakProminence',4);
pks = -pks;
idx = find(M2B{:,3} == pks(:,1);
loc = M2B{:,2}(idx);
this does however not work, if i insert pks (1,1) it does work but i dont get it to work for all values. Can anybody help?

  0 Comments

Sign in to comment.

Accepted Answer

Matt J
Matt J on 24 Feb 2020
[pks,idx] = findpeaks (-M2B{:,3},'MinPeakProminence',4);
pks = -pks;
peak_time=M2B{idx,1};
peak_displacement=M2B{idx,2};

  1 Comment

jop schilder
jop schilder on 24 Feb 2020
Thanks!

Sign in to comment.

More Answers (0)

Sign in to answer this question.