Truncating Y values during integration to integrate only the "peaks" or delete CERTAIN elements from a matrix
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153079/image.jpeg)
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)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153080/image.jpeg)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153081/image.jpeg)
I have tried to simply make a conditional statement to remove all data less than 1:
E=C;
E(E<1)=0;
plot(E)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153082/image.jpeg)
However, this is not correct as what I am after is more like this (edited on MS paint):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153083/image.png)
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 commentaires
Réponses (1)
Azzi Abdelmalek
le 18 Nov 2013
findpeaks(y,'minpeakheight',1)
3 commentaires
Azzi Abdelmalek
le 18 Nov 2013
Modifié(e) : Azzi Abdelmalek
le 18 Nov 2013
[x_peak,x_location]=findpeaks(y,'minpeakheight',1)
Voir également
Catégories
En savoir plus sur Numerical Integration and Differentiation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!