bandpass butterworth filter cutoff frequencies
조회 수: 8 (최근 30일)
이전 댓글 표시
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')
댓글 수: 0
답변 (1개)
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.
댓글 수: 1
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!