Peak detection using MATLAB (signal processing)
Well, if x is your ECG, (or whatever signal),
you can threshold with
x > threshold;
Now, this is a vector with zeros and ones.
At ones, the signal is above the threshold.
ind = x > threshold;
plot(1:length(x), x, find(ind), x(ind), 'o')
This will probably be rather close to the desired output, but if there are successive values of x above the threshold, this won't come out right. You would have to determine the maximum of these successive values. I'd use the diff-command to differentiate as that ought to be quite simple to implement, but you may have other preferences.