- Identify the index of the peak value
- Identify the threshold value
- Using the index in #1, find the index of the first value that is <=threshold value starting at the peak. To get its index in the full WF data, you will need to add the index from #1 to the result. Something like this might work (untested)
How to select values in an array until a known value
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I will explain my problem. I have a 1x1701 sampled array "resampled_WF", once I found the max value of this array ("peak_WF"), I set a threshold 0.7*peak_WF, and I would like to select the farthest value in the array that gets nearer to this threshold.
Example:

As you can see, I was able to select ony the first value that resembles... but I would like to get the last one (around t=2 sec).
I tried to flip the array with "flip" function:
WF_threshold_input = 0.7*peak_WF;
flip_resampled_WF = flip(resampled_WF);
diff_peak_threshold = peak_WF - WF_threshold_input; %power loss at 70% power reduction
diff_peak_WF = peak_WF - flip_resampled_WF;
min_diff_threshold = min(abs(diff_peak_WF-diff_peak_threshold));
Doing that, MATLAB computes minimum difference on the whole array, I would like to stop at the first value, not considering further values.
I tried to select values with values<= WF_threshold_input, but again it selects over the whole dataset.
How can I select the value properly?
Thanks!!
0 Kommentare
Antworten (1)
Cris LaPierre
am 22 Jul. 2020
ind = find(resampled_WF(indPk:end)<=WF_threshold_input,1) + indPk-1;
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!