if INDICATOR == 2 yPSD_V2 = yPSD_V2/100; n1 = 0; n2 = 0; clear Xp Yp [Xp, Yp] = ginput; for i = 1:2: length(Xp)
if Xp(1) < xPSD_V2(end) [whatever minR2] = min(abs(xPSD_V2-Xp(i))); [whatever maxR2] = min(abs(xPSD_V2-Xp(i+1))); if max(yPSD_V2(minR2:maxR2)) > 3*BASELINE2 n2 = n2+1; PEAK_Y2(n2) = max(yPSD_V2(minR2:maxR2)); for freq = minR2:maxR2 if yPSD_V2(freq) == PEAK_Y2(n2) Xpeaks2(n2) = xPSD_V2(freq); end end end end [whatever minR1] = min(abs(xPSD_V1-Xp(i))); [whatever maxR1] = min(abs(xPSD_V1-Xp(i+1))); if max(yPSD_V1(minR1:maxR1)) > 3*BASELINE1 n1 = n1+1; PEAK_Y1(n1) = max(yPSD_V1(minR1:maxR1)); for freq = minR1:maxR1 if yPSD_V1(freq) == PEAK_Y1(n1) Xpeaks1(n1) = xPSD_V1(freq); end end end