getting the area under the peaks
12 vues (au cours des 30 derniers jours)
Star Strider le 18 Nov 2017
I would first identify the low points (‘valleys’) by inverting your signal and then using the Signal Processing Toolbox findpeaks function to locate them. Then integrate between those points to identify the peaks.
t = linspace(0, 10*pi, 250); % Create Data
s = sin(t) + 0.2*cos(5*t) + 2; % Create Data
[Vlys, Idx] = findpeaks(-s, 'MinPeakHeight',-1.1);
Area = cumtrapz(t,s);
idxvct = [1 Idx length(s)];
for k1 = 1:length(idxvct)-1
PkAreas(k1) = Area(idxvct(k1+1)) - Area(idxvct(k1));
The ‘PkAreas’ vector will have the areas of the peaks.
You will have to adapt this to your data. Be sure to plot the negative of your data first so you can see and set the appropriate arguments for findpeaks.