フィルターのクリア

bandpass butterworth filter cutoff frequencies

14 ビュー (過去 30 日間)
G
G 2018 年 12 月 2 日
コメント済み: Elysandra Solis 2022 年 10 月 27 日
I am trying to create a band-pass butterworth filter from 0.4 to 5 Hz... Here is my code:
I am getting an error that the cutoff frequencies must be within the interval of (0,1)... I need the the range to be from 0.4 to 5Hz
clear,clc
load('DATA_01_TYPE01.mat')
A = sig;
x = A(3,1:1000); %PPG channel
y=A(4,1:1000); %x-axis acceleration
t=1:1:1000;
subplot(3,1,1)
plot(t,x,t,y)
title('Filtered Signals')
xlabel('Sampling Points')
legend('PPG','Acceleration','Location','Southeast','Orientation','Horizontal')
[b,a] = butter(2,[0.4 5],'bandpass');
dataPPG = filter(b,a,x);
dataAcc = filter(b,a,y);
subplot(3,1,3)
plot(t,dataPPG,t,dataAcc)
title('Filtered Signals')
xlabel('Sampling Points')
legend('PPG','Acceleration','Location','Southeast','Orientation','Horizontal')

回答 (1 件)

Areej Varamban Kallan
Areej Varamban Kallan 2018 年 12 月 5 日
Hi G,
The second argument to the 'butter' function should be the required cut off frequencies divided by half of the sample rate. For example, if you need to design a band pass filter with a lower cutoff frequency 500 Hz and a higher cutoff frequency of 600 Hz and at a sample rate of 1500 Hz, then the second argument to the butter function should be [500 600]/750.
Please refere to the documentation of butter for more information.
  1 件のコメント
Elysandra Solis
Elysandra Solis 2022 年 10 月 27 日
I am having the same issue with my code and I have the right formula but it is still giving the same error.
set_sampfreq = 1000;
nyq_sampfreq = set_sampfreq/2;
ogsampfreq = [];
filter_range = [0.1 500]; % insert as a matrix
filtorder = 4;
ftype = 'bandpass';
[b a] = butter(filtorder,[filter_range(:,1)/nyq_sampfreq filter_range(:,2)/nyq_sampfreq],ftype);

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by