function [spectrum_filtered,g]=freq_space_low_pass_filter(spectrum, SampleRate, Freq3db)
	%% applies low pass filter in the frequency domain
	% spectrum - result of fft on time series data (column vector is expected)
	% SampleRate - measured in Hz, 1/dt where dt spacing of the points in time domain
	% Freq3db - desired 3db roll off point in Hz

	N=length(spectrum);


	function G=filter_gain(freq, Freq3db)
		G=1./(1+1i*freq/Freq3db); % this corresponds to low pass RC filter
	end

	spectrum_freq=fourier_frequencies(SampleRate, N);

	% calculate filter gain for each spectrum frequency
	g=filter_gain(spectrum_freq, Freq3db);
	spectrum_filtered=spectrum.*g;
end



 
