I'm recording a signal (skin conductance) over time, i.e. I have a time series. Unfortunately, the signal is affected by movement. In a user guide I have now read the following:
A low pass filter should be applied to the data to remove high frequency noise which can be attributed to movement artifact and other noise components. A cutoff frequency of as low as 1 - 5 Hz can be used without affecting the data of interest due to the slowly varying nature of GSR responses.
How can I apply such a low pass filter with a cutoff frequency to my time series in Matlab or Python?
In Matlab, the easiest way to do this is probably to make use of the butter
command (to find the coefficients of your digital filter), followed by the filter
command: https://www.mathworks.com/help/signal/ref/butter.html
butter(n, Wn)
will take as parameters the order of the filter you want to design (the higher the order, the more ideal in behavior the filter), and the normalized frequency, Wn. Typically, in order to design the filter correctly, you need to know at what frequency (Hz) your raw data was sampled.
Since you only need to remove baseline low frequency noise, use a high pass filter.
Example:
rawdata=rand(1000,1); %randomly generated data
fs=1000; %frequency at which your data was sampled, assuming 1000 Hz here
fc=5; %cut-off frequency (you mentioned 1-5 Hz in your question so I used 5)
Wn= fc/fs; % Normalized frequency
filt_order=8; % arbitrarily chose an 8th order filter
[b,a]=butter(filt_order,Wn, 'high');
% butter creates the coefficients of your digital filter
% the optional parameter 'high' specifies a high-pass filter
filtered_data=filter(b,a,rawdata);