Filtering .csv file

13 visualizaciones (últimos 30 días)
Sonali Sahansra
Sonali Sahansra el 18 de Feb. de 2020
Editada: Anurag Ojha el 25 de Oct. de 2023
Hello,
I am using Galvanic Skin Response (GSR) to measure the skin conductance whose reponse is displayed on Neulog. The samping rate is 20samples/second for the duration of 10 seconds. The data is saved in form of CSV file. I have displayed the signal using following code.
dataset = xlsread('rohit calm 1.csv', 'rohit calm 1', 'A8:B209');
y=dataset(:,2);
x= dataset(:,1);
plot(x,y)
xlabel ('X Time(seconds)')
ylabel('Y / GSR Amplitude(uS)')
grid on
Now I don't know how to apply filter to this as I am new to Matlab. I need to process the signal to eliminate artifacts from my signal. How can i apply filter to my .csv file? I would be delighted to any help.
  1 comentario
Vladimir Calderón
Vladimir Calderón el 13 de Sept. de 2021
In brief:
filter slow component (low pass)
and detect onsets of the phasic componentes (fast increase-slow decrease)

Iniciar sesión para comentar.

Respuestas (1)

Anurag Ojha
Anurag Ojha el 25 de Oct. de 2023
Editada: Anurag Ojha el 25 de Oct. de 2023
Hi Sonali ,
As per my understanding, you want to know how to apply filters in order to eliminate artifacts from your signal.
In order to eliminate disturbance, you can use the Butterworth Filter. It is used to define a low-pass filter, which is applied to remove high-frequency noise and retain the lower-frequency components of interest.
We need to use “butter” in combination with “filtfilt”, which is used to ensure that the filtering process does not introduce phase distortions into the data, which can be critical when working with physiological signals like GSR.
Here is a sample code to apply “Butterworth filter” to a signal :
% Load your dataset
dataset = xlsread('rohitcalm1.csv', 'rohit calm 1', 'A8:B209');
y = dataset(:, 2);
x = dataset(:, 1);
% Define filter parameters
order = 4; % Filter order (you can adjust this)
cutoff_freq = 2; % Cutoff frequency in Hz
% Design the low-pass Butterworth filter
[b, a] = butter(order, cutoff_freq / (20 / 2)); % 20 is the sampling rate
% Apply the filter to your GSR data
filtered_data = filtfilt(b, a, y);
% Plot the filtered data
plot(x, y, 'b', x, filtered_data, 'r');
xlabel('Time (seconds)');
ylabel('GSR Amplitude (uS)');
legend('Original', 'Filtered');
grid on;
Please refer to following MATLAB documentation to explore more:
I hope this helps to resolve your query.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by