I want to be able to only analyze the actual loading portion of a curve

Hello,
I am new to MATLAB, and still trying to figure things out. Please forgive me if I have a overly simple question.
Currently, I am working with multi-axial force data (Fx, Fy, Fz) collected during animal locomotion trials. I am trying to calculate certain variables from the curve, including impulse, Fz peak, etc. In order to start analyzing, I was hoping to clip the curve based on when loading actually occurs (see image below), therefore limiting any extraneous noise that may alter the data.
I would also like MATLAB to report the beginning and end times for a particular loading cycle.
Any help on this would be greatly appreciated.
All the best, Michael

답변 (1개)

Star Strider
Star Strider 2014년 10월 1일

1 개 추천

I would threshold the blue curve to find the first and last indices where it exceeds 1. You can then subtract and add a few indices at the beginning and end respectively to include everything you need. Use the find command twice, once with the 'first' option to find the beginning of the rise of the blue curve, and 'last' to find the end. Those indices will be the same for all your curves and for your time variable.

댓글 수: 10

Thanks for your response. I am still having some trouble trying to code this.
Here is what I wrote:
Where Fz is the blue curve
ind1 = find(Fz, 1, 'first'); ind2 = find(Fz, 1, 'last');
Any suggestions?
Yes.
ind1 = find(Fz >= 1, 1, 'first');
ind2 = find(Fz >= 1, 1, 'last');
That should work.
Thank you! It seemed to work perfectly! Any advice on how to identify the time?
For example I have a time column (t). Any suggestions how to say: Find "t" at ind1
Like this?
t1 = find (t, ind1);
My pleasure!
Yes.
t1 = t(ind1);
and so for the rest.
Thank you so much, I really appreciate your help. I have another really simple question that I keep getting thwarted on I want to make a plot of Fz (blue line) over my new adjusted time (i.e., t1=first and tz=last)
This is my attempt:
plot (t (t1:t2), [Fz]);
Thoughts?
My pleasure!
I would guess you’re getting the ‘vectors must be the same lengths’ error.
Try this:
plot(t(ind1:ind2), Fz(ind1:ind2))
assuming ‘ind1’ and ‘ind2’ are defined as in:
ind1 = find(Fz >= 1, 1, 'first');
ind2 = find(Fz >= 1, 1, 'last');
That should work.
Thank you so much!
My pleasure!
The sincerest form of appreciation here on MATLAB Answers is to Accept the answer that most closely solves your problem.
You can also vote to give double points. At least I voted anyway.
@Image Analyst — Thank you!

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

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

질문:

2014년 10월 1일

댓글:

2014년 10월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by