function bfilt(A, startPoint, altLow, altHigh)

f = 4000;  % sampling frequency
d = f*3/4; % sample duration
cycle = 48135; % length of full cycle of signals
dataLen = size(A,1);
if(dataLen <= cycle), A = [A ; A]; end

lows =  [1002 310  97  980 319  98];
highs = [1007 316 103 1115 326 102];

if(startPoint <= 6)
    if(nargin < 3)
        lo=lows(startPoint);
        hi=highs(startPoint);
    else
        lo = altLow;
        hi = altHigh;
    end
    [b,a]=butter(4,[lo,hi]/f*2);
    for (ch=4:10),
        subplot(7,1,ch-3);
        plot(filter(b,a,A(:,ch)));
    end
    return
end

output = num2str(startPoint);
sourceStart = startPoint+f*[-8 -7 -6 -1 0 1];
negatives = find(sourceStart < 1);
if(~isempty(negatives)),
    sourceStart(negatives) = sourceStart(negatives) + cycle
end
toobigs = find(sourceStart + d > dataLen);
if(~isempty(toobigs)),
    sourceStart(toobigs) = sourceStart(toobigs) - cycle
end
noiseStart = startPoint+f*-4;
if(noiseStart < -d), noiseStart = noiseStart + cycle, end;
if(noiseStart < 1), noiseStart = 1, end;
if(noiseStart + d > dataLen), noiseStart = noiseStart - cycle, end;
if(noiseStart + 2*d > dataLen), noiseStart = dataLen-2*d, end;

for(iSource = 1:6)
    [b,a]=butter(4,[lows(iSource),highs(iSource)]/f*2);
    for(ch = 4:10)
        filtData = filter(b,a,A(:,ch));
        sourceRange = sourceStart(iSource):sourceStart(iSource)+d;
        noiseRange = noiseStart:noiseStart + d*2;
        if(dataLen > 104000)
            for(iRange = 1:8)
                offset = iRange * cycle;
                sourceRange = [sourceRange sourceStart(iSource)+offset:sourceStart(iSource)+d+offset];
                noiseRange = [noiseRange noiseStart+offset:noiseStart + d*2+offset];
            end
        end
        signal = norm(filtData(sourceRange))/sqrt(length(sourceRange));
        noise = norm(filtData(noiseRange))/sqrt(length(noiseRange));
        output = [output ',' num2str(signal)];
        output = [output ',' num2str(noise)];
    end
end
disp(output);