如何在matlab中对edf数据使用椭圆滤波器
How to use elliptic filter in matlab for edf data
我使用 edfread 来读取 EEG 数据,我将其存储在一个名为 plotData 的变量中。我想知道如何实现椭圆滤波器,从其中一个通道中提取 7-9 Hz(α 波段)。
存储在 plotData 中的 EDF 数据如下所示。
plotData =
ver: 0
patientID: 'test '
recordID: 'test '
startdate: '23.06.16'
starttime: '12.10.38'
bytes: 9472
records: 3
duration: 1
ns: 36
label: {1x36 cell}
transducer: {1x36 cell}
units: {1x36 cell}
physicalMin: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
physicalMax: [1x36 double]
digitalMin: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
digitalMax: [1x36 double]
prefilter: {1x36 cell}
samples: [1x36 double]
如果我正确理解您提供的 EDF 数据,在 1 秒的 duration
内有 36 个样本 (ns
),这给您提供了 36Hz 的采样率。
然后可以使用内置 ellip
函数完成数字椭圆滤波器的设计。您需要填写通带纹波、阻带衰减和过渡带的滤波器要求。以提供的一些参数为例,这看起来像:
fs = 36; % sampling rate in Hz
fmin = 7; % minimum passband frequency in Hz
fmax = 9; % maximum passband frequency in Hz
order = 5; % filter order (the higher the narrower the transition band)
Rs = 20; % stopband attenuation in dB
Rp = 1; % passband ripples in dB
[b,a] = ellip(order, Rp, Rs, [fmin/(fs/2), fmax/(fs/2)]);
然后您可以使用 freqz
可视化结果响应(并根据需要进行调整)。对于上述参数,频率响应如下所示:
最后,要过滤掉您的数据,您将使用具有上述设计的过滤器系数 a
和 b
的 filter
函数以及您的输入 plotData
:
filtered_data = filter(b,a,plotData);
我使用 edfread 来读取 EEG 数据,我将其存储在一个名为 plotData 的变量中。我想知道如何实现椭圆滤波器,从其中一个通道中提取 7-9 Hz(α 波段)。
存储在 plotData 中的 EDF 数据如下所示。
plotData =
ver: 0
patientID: 'test '
recordID: 'test '
startdate: '23.06.16'
starttime: '12.10.38'
bytes: 9472
records: 3
duration: 1
ns: 36
label: {1x36 cell}
transducer: {1x36 cell}
units: {1x36 cell}
physicalMin: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
physicalMax: [1x36 double]
digitalMin: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
digitalMax: [1x36 double]
prefilter: {1x36 cell}
samples: [1x36 double]
如果我正确理解您提供的 EDF 数据,在 1 秒的 duration
内有 36 个样本 (ns
),这给您提供了 36Hz 的采样率。
然后可以使用内置 ellip
函数完成数字椭圆滤波器的设计。您需要填写通带纹波、阻带衰减和过渡带的滤波器要求。以提供的一些参数为例,这看起来像:
fs = 36; % sampling rate in Hz
fmin = 7; % minimum passband frequency in Hz
fmax = 9; % maximum passband frequency in Hz
order = 5; % filter order (the higher the narrower the transition band)
Rs = 20; % stopband attenuation in dB
Rp = 1; % passband ripples in dB
[b,a] = ellip(order, Rp, Rs, [fmin/(fs/2), fmax/(fs/2)]);
然后您可以使用 freqz
可视化结果响应(并根据需要进行调整)。对于上述参数,频率响应如下所示:
最后,要过滤掉您的数据,您将使用具有上述设计的过滤器系数 a
和 b
的 filter
函数以及您的输入 plotData
:
filtered_data = filter(b,a,plotData);