function [ filteredSig, pwMeanMove, pwMeanRest, hz ] = myFilter( splitSignals,code,NFFT )
    %Filter around 50Hz and below 2 Hz
    [A,B]= butter(2,[48 52]/1250,'stop');
    [C,D]= butter(2,2/1250,'high');
    
    
    filteredSig=zeros(size(splitSignals));
    pwMeanMove=zeros(NFFT/2+1,size(splitSignals,2));
    pwMeanRest=zeros(NFFT/2+1,size(splitSignals,2));

    for i=1:size(splitSignals,2) %filter single channel
        for j=1:size(splitSignals,3) %filter single trial
            filteredSig(:,i,j)=filter(C,D,filter(A,B,splitSignals(:,i,j)));
            if code(j)<=5
                pwMeanMove(:,i)=pwMeanMove(:,i)+pwelch(filteredSig(:,i,j),[],[],NFFT,2500);
            elseif code(j) > 5
                pwMeanRest(:,i)=pwMeanRest(:,i)+pwelch(filteredSig(:,i,j),[],[],NFFT,2500);
            end
            %s=cat(1,s,size(pwelch(filteredSig(:,i,j),[],[],[],2500)));
        end
        pwMeanMove(:,i)=pwMeanMove(:,i) /size(find(code <=5),1);
        pwMeanRest(:,i)=pwMeanRest(:,i) /size(find(code > 5),1);
    end
    [a,hz]=pwelch(filteredSig(:,1,1),[],[],NFFT,2500);
end

