Filtering .csv file

10 次查看(过去 30 天)
Sonali Sahansra
Sonali Sahansra 2020-2-18
编辑: Anurag Ojha 2023-10-25
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 个评论
Vladimir Calderón
Vladimir Calderón 2021-9-13
In brief:
filter slow component (low pass)
and detect onsets of the phasic componentes (fast increase-slow decrease)

请先登录,再进行评论。

回答(1 个)

Anurag Ojha
Anurag Ojha 2023-10-25
编辑:Anurag Ojha 2023-10-25
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.

类别

Help CenterFile Exchange 中查找有关 Measurements and Statistics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by