필터 지우기
필터 지우기

How can i find two certain points of data set?

조회 수: 1 (최근 30일)
Georg Gamauf
Georg Gamauf 2016년 6월 10일
댓글: Georg Gamauf 2016년 6월 10일
Hello!
I want to find to certain points of a plot. The plot is attached:
The x-axis shows the time, that is the variable timeMsT; the y-axis shows the force, that is saved in the variable chB and i plotted it with:
plot(timeMsT,chB);
I need to find the rising and the falling value of the peak. I already calculated the "initial force": 1194.3592 mV. My "treshold" is about 100mV above the initial force - so ~1300 mV. I need the left and the right value of time (ms), where the force crosses this treshold value - obviously it will be about 40 and 70 ms - to calculate the duration of the impact. I already tried to use the "find"-function, but until now it didn't work.
It would be very thankful for a few ideas. :-)
Kind regards, Georg

채택된 답변

Image Analyst
Image Analyst 2016년 6월 10일
Try this:
threshold = initialForce + 100;
firstIndex = find(chB > threshold, 1, 'first');
lastIndex = find(chB > threshold, 1, 'last');
firstTime = timeMsT(firstIndex);
lastTime = timeMsT(lastIndex);
  댓글 수: 1
Georg Gamauf
Georg Gamauf 2016년 6월 10일
That seems to work perfectly, thank you. :-)
Can you explain to me how these two lines work:
firstIndex = find(chB > threshold, 1, 'first');
lastIndex = find(chB > threshold, 1, 'last');
Kind regards,
Georg

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by