How can I define EMG-Onset Markers?

Hello,
I am trying to analyze 2 EMG-traces. Therefore I need to define burst onset markers.
Here is my script so far:
load('XXX_1_A.mat') %loading my file
D=cell2mat(Data); %transforming from cell to double
X=D(:,1); %trace 1
Y=D(:,2); %trace 2
X1(:,1)=X(1:end-2); X1(:,2)=X(2:end-1); X1(:,3)=X(3:end); Xm=X1(:,2).^2-X1(:,1).*X1(:,3);Xm=Xm/std(Xm);
Y1(:,1)=Y(1:end-2); Y1(:,2)=Y(2:end-1); Y1(:,3)=Y(3:end); Ym=Y1(:,2).^2-Y1(:,1).*Y1(:,3); Ym=Ym/std(Ym);
%Teager-Kaiser algorythm for EMG preprocessing
plot([1:length(Xm)]/1500,abs(Xm)) %plotting both EMG-traces, rectifying, 1500Hz sampling rate
hold
plot([1:length(Ym)]/1500,abs(Ym))
Next I want to manually set onset markers on one (trace 1) of both EMG-traces using "ginput", returning the time point (x-axis). From this time point I need the average of 1sec pre-marker baseline activity of the other (trace 2) trace. As soon as this average baseline activity is exceeded by 3 standard deviations I would like to automatically set a second burst onset marker on trace 2 and return the according time point.
All of this is done to compute the latency between both traces.
How can I implement this?
Thanks! Tom

Risposte (0)

Categorie

Richiesto:

il 5 Ott 2017

Modificato:

il 5 Ott 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by