Truncating Y values during integration to integrate only the "peaks" or delete CERTAIN elements from a matrix
2 views (last 30 days)
Show older comments
I have a load of data from a force transducer output. The data is in the form of time vs volts.
TEXT=fopen('Test 5.txt','rt');
texta=textscan(TEXT,'%f%f','CommentStyle','"');
A=texta{1};
B=texta{2};
C=[A,B];
D=C;
plot(D)
The first part of my script removes the -ve values, as this relates to the compression wave recoiling in the force transducer and doesn't actually relate to compressive forces at all.
C(C<0)=0;
plot(C)
So far so good.
I am measuring the peak impulse above a certain range — impulse being the integral of force*time (or volts*time in this instance as the transducer outputs a voltage and I haven't included the conversion yet).
To measure the peak impulse I only need the values above a certain range, say 1.
I have tried to simply make a conditional statement to remove all data less than 1:
E=C;
E(E<1)=0;
plot(E)
However, this is not correct as what I am after is more like this (edited on MS paint):
Does anyone have any ideas on how I can, either:
- Limit the Y values used to numerically integrate the data i.e ymin=1
- Remove the data in such a fashion as to resemble the final image above?
Any help would be appreciated!!! Mark.
EDIT:
Please note that I cannot simply state that E(E<1)=1 as this would artificially inflate the integral. I need all the data below that point to basically disappear.
0 Comments
Answers (1)
Azzi Abdelmalek
on 18 Nov 2013
findpeaks(y,'minpeakheight',1)
3 Comments
Azzi Abdelmalek
on 18 Nov 2013
Edited: Azzi Abdelmalek
on 18 Nov 2013
[x_peak,x_location]=findpeaks(y,'minpeakheight',1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!