[Eeglablist] peaks detection
Pratik Chhatbar
pratikchhatbar at gmail.com
Mon Jul 7 10:41:50 PDT 2014
Hello Elisa,
I prefer writing my own functions/scripts for custom problems like this
rather than using packaged functions like 'findpeaks' which barely address
individualized requirements. For your specific question, given your
external trigger generates similar signals every time (that is, amplitude
of waviness in the signal and step function amplitude remains comparable -
at least amplitude of step function is at least twice the height of
waviness - in short, good 'signal-to-noise' ratio), you should use
numerical differential of your signal to find peak/troughs and then select
the ones with your desired step function amplitude.
If the external trigger output is saved as YourSignal (nx1 vector, with no
clipping of step functions at beginning/end of saved output) in matlab
workspace and you want a step function that is bigger than YourThreshold
(1x1 scalar), try the following commands:
peaktroughindex=find(diff(sign(diff([0;0;YourSignal])));
diffval=[0;diff(YourSignal(peaktroughindex))];
stepstartindex=peaktroughindex(find(diffval>YourThreshold));
stependindex=peaktroughindex(find(diffval<-YourThreshold));
stepmiddleindex=round(stepstartindex/2+stependindex/2);
Please excuse any typos - I quickly scribbled it and did not test it in the
editor - I will be happy to follow-up on it if you need.
Hope this helps,
Pratik.
----
Pratik Yashvant Chhatbar, MBBS, PhD
Postdoctoral Scholar, Feng Lab
Stroke Center at Neurology Division
MUSC Neurosciences, Charleston, SC
Desk: 843-792-3112
Cell: 917-892-2314
On Thu, Jul 3, 2014 at 5:11 PM, Elisa Carlino <elisa.carlino at gmail.com>
wrote:
> Dear all,
> i have the following problem on my EEG data.
> I have a noisy wave generated by an external trigger
> and I need to transform this wave into squared waves
> in order to use these waves as events for the
> erp analysis.
>
> I attach a jpg of my wave (first line in blu) and a set
> of waves that i desire (red waves): i need
> - squared waves or
> - the first peak of each wave (desirable option) or
> - the middle peak of each wave or
> - the final peak of each wave.
> With the peak I can subsequently epoch
> the EEG and analyze the ERPs.
>
> I looked at this function:
> [pks,locs] =
> findpeaks(canaleTrigger,'MinPeakHeight',2000000,'MinPeakDistance',100,'THRESHOLD',2000000);
>
> I tried to change the values but unsuccessfully.
> When I apply this function the program finds too many peaks
> and not the first peak of each wave.
> Is this function correct? How can I successfully apply the function?
> Are there other ways to solve this problem?
>
> Thanks,
>
> Elisa
>
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20140707/5ef6475e/attachment.html>
More information about the eeglablist
mailing list