How to calculate the period of an input signal?

조회 수: 7 (최근 30일)
Maxwell MacFarlane
Maxwell MacFarlane 2020년 4월 14일
댓글: Image Analyst 2020년 4월 15일
Hi,
I am carrying out an investigation where I have applied an impluse to an object. What is the best way to calcualte the duration of the impusle? I have attached a photo of the graphs I have created to give a visual representation of the data I have collected.
Any help would be much appreciated.
Max

답변 (1개)

Image Analyst
Image Analyst 2020년 4월 14일
You can use thresholding and find(). Pick some Force value that you consider to be in the pulse. Assuming just one pulse:
leftIndex = find(Force > someValue, 1, 'first');
rightIndex = find(Force > someValue, 1, 'last');
pulseWidth = t(rightIndex) - t(leftIndex); % Compute delta time using time vector, t.
If there are multiple pulses, then you'll have to do a little more to get the width of each one separately. Hint: use regionprops():
props = regionprops(Force > someValue, 'PixelIdxList');
It can also get more complicated if you want to do things like get rid of short noise pulses, etc.
  댓글 수: 2
Maxwell MacFarlane
Maxwell MacFarlane 2020년 4월 15일
Thank you for this suggestion. I'm still struggling with what values to pick. Ideal I would like to choose the starting value however you can see before 2 seconds in the first graph there is a slight increase therefore this code picks up that point instead of the start of the impulse.
Do you have any suggestions on how to over come this when batch processing for all my data points?
Image Analyst
Image Analyst 2020년 4월 15일
What threshold value did you use? If you need more help, attach your data in a .mat file.
In the meantime, you might try the findchangepts() function.

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

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by