Eliminating noise in a vibration analysis study

1 view (last 30 days)
I have accelerometer data for an underdamped system and I need to delete everything before the max deflection. Does anybody know how I can find which vector element the max is and then delete everything above it.
For example: b = [.3;.2;.34;12;10;7]
And I need to know that the max is 12 and create another vector that is bb = [12;10;7] but with many more vector elements.
Can anyone help me out?

Accepted Answer

Image Analyst
Image Analyst on 16 Oct 2014
Liza: Try this:
% Find the max value and where it's located.
[mavValue, indexOfMaxValue] = max(b);
% Extract elements after the index of the max:
bb = b(indexOfMaxValue : end);
I really suggest you use more descriptive variable names than b and bb, like I did above for the new variables. I wouldn't want your code to look like an un-maintainable alphabet soup of code that's a total mess.
Your plot is slightly different since there's a very large value that's not quite as tall as the max. If you want that you need to threshold
indexOfMaxValue = find(b>2, 1, 'first');
% Extract elements after the index of the first value greater than 2:
bb = b(indexOfMaxValue : end);
  1 Comment
Image Analyst
Image Analyst on 16 Oct 2014
Liza's answer moved from an Answer to a comment here:
This is awesome. Thank you so much! And thanks for the tip

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!