function A = FilterG(Ao, dt, T, norm)
%function A = FilterG(Ao, dt, T, norm)
%
%	Ao - Original time series, can be a set of time series
%	dt - sample interval, must be a single value
%	T - dominant period of Gaussian filter
%	norm - normalize output, 1 - yes, 0 - no
%

[xn,yn] = size(Ao);
exchanged = 0;
if xn > yn
	Ao = Ao';
	exchanged = 1;
end

t = -T:dt:T;
a = 10*(1/T)^2;
wn = exp(-a*t.^2);
nsAo = length(Ao(:,1));
ptsAo = length(Ao(1,:));
A = zeros(size(Ao));

for j = 1:nsAo
	a = convn(Ao(j,:),wn,'same')/sum(wn);
	if norm == 1
		A(j,:) = a(1:ptsAo)/max(abs(a(1:ptsAo)));
	else
		A(j,:) = a(1:ptsAo);
	end
end

if exchanged == 1
	A = A';
end

return
