1
$\begingroup$

if we create a continuous signal from epoched data (say, EEG data with 100 epoches), what kind of problems it may cause( i am only aware of edge artifacts ) and how i can avoid them in analysis (say, power analysis)? Thanks in advance,

$\endgroup$
2
$\begingroup$

You may have problems related to discontinuity and this can give small glitches in your signal, if you hear your signal you will notice pops/clicks artifacts at every 100 epoches edge, one way to try avoid this problem is apply one window function in a overlapped segments between your Epoches.

When you apply a window like a Hann window this reduces the amplitude of the components of the outlet ends of the window and its suppress the edge artifacts when reconstructing your signal to be continuos, for it you need use technics like overlap and add to works like a crossfading between every overlapped segments.

OK you asked for example, i can show you the basic concept, imagine two sinusoids at 100hz, if you try join you will have problems, take a look:

enter image description here

In this plot is clear that the end of the sine wave does not match with the beginning of another, and this cause the problem described above.

One way to do try avoid it is apply a crossfade, here an example:

Fs=22050;
f=100
winsize=2048;

%creating signal
signal1= 0.9*sin(2*pi*f/Fs*(1:winsize));
signal2= 0.9*sin(2*pi*f/Fs*(1:winsize));

%use plot(in) to see the first image plot in this answer
in=[signal1 signal2];


%create a hann window
window1=hann(winsize)';
window2=hann(winsize)';

%i'm using just the last half values of the hann window to skip fade in     
window1(1:winsize/2)=ones;

%i'm using just the first half values of the hann window to skip fade out  
window2(winsize-(winsize/2):winsize)=ones;

%apply window in signal1 and signal2
teste1=(signal1.*window1);
teste2=(signal2.*window2);

%apply 50% crossfade between signal1 and signal2
OverlapCrossfade=teste1(length(teste1)/2:length(teste1)-1) +  teste2(1:length(teste2)/2);

%rebuild the signal after crossfade
join = [teste1(1:length(teste1)/2) OverlapCrossfade teste2(length(teste2)/2:length(teste2)-1)];

Now if you do plot(join) you can see it:

enter image description here

OW this is better i cant see glitches (but we can see amplitude variation), now all that you need to do is apply some type of envelope adjust.

$\endgroup$
3
  • $\begingroup$ Thanks @ederwander for your answer. However, would you please give me an example how to to this in Matlab? Thanks again $\endgroup$ Aug 7 '14 at 2:58
  • $\begingroup$ OK take a look in how do the basic ... $\endgroup$
    – ederwander
    Aug 7 '14 at 20:02
  • 1
    $\begingroup$ many thanks @ederwander, you are amazing! $\endgroup$ Aug 8 '14 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.