# Epoched data to a continuous signal

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,

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:

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

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