Butterworth Filters

버전 1.3.0.0 (120 KB) 작성자: Chad Greene
Highpass, lowpass, bandpass, and bandstop Butterworth frequency filters.
다운로드 수: 4.6K
업데이트 날짜: 2012/10/15

라이선스 보기

This set of functions is simply four built-in Matlab functions, repackaged for ease of use (Signal Processing Toolbox is required). If you don't want to go through the rigmarole of designing and implementing a filter with normalized frequencies and so forth every time you filter a signal, this package may be for you. If you are a Matlab pro and an expert in digital signal processing, you will probably not be impressed.

Each function takes the form [filtered_signal,filtb,filta] = bandstop_butterworth(inputsignal,cutoff_freqs,Fs,order)

INPUTS:
inputsignal = input time series
cutoff_freqs = filter corner frequencies in the form [f1 f2]
Fs = data sampling frequency
order = order of Butterworth filter

OUTPUTS:
filtered_signal = the filtered time series
filtb, filta = filter numerator and denominator (optional)

EXAMPLE 1:
load train
t = (1:length(y))/Fs;
y_filt = bandstop_butterworth(y,[800 1000],Fs,4); % cut off between 800 Hz and 1000 Hz

figure
plot(t,y,'b',t,y_filt,'r')
xlabel('time in seconds')
box off
legend('unfiltered','filtered')
sound(y,Fs) % play original time series
pause(2) % pause two seconds
sound(y_filt,Fs) % play filtered time series

EXAMPLE 2:
load train
t = (1:length(y))/Fs;
[y_filt,filtb,filta] =bandstop_butterworth(y,[800 1000],Fs,4); % cut off between 800 Hz and 1000 Hz
[h1,f1] = freqz(filtb,filta,256,Fs);

figure
subplot(3,1,1)
plot(t,y,'b',t,y_filt,'r')
xlabel('time in seconds')
box off
text(0,.1,' time series','units','normalized')

subplot(3,1,2)
AX = plotyy(f1,10*log10(abs(h1)),f1,angle(h1),'semilogx');
set(get(AX(1),'ylabel'),'string','gain (dB)')
set(get(AX(2),'ylabel'),'string','phase (rad)')
xlim(AX(1),[min(f1) max(f1)])
xlim(AX(2),[min(f1) max(f1)])
text(0,.1,' filter response','units','normalized')
box off

[Pxx,f] = pwelch(y,512,256,[],Fs,'onesided');
[Pxxf,f_f]= pwelch(y_filt,512,256,[],Fs,'onesided');
subplot(3,1,3)
semilogx(f,10*log10(Pxx))
hold on
semilogx(f_f,10*log10(Pxxf),'r')
xlabel('frequency (Hz)')
ylabel('PSD (dB)')
xlim([min(f1) max(f1)])
box off
legend('unfiltered','filtered','location','northwest')
legend boxoff

인용 양식

Chad Greene (2024). Butterworth Filters (https://www.mathworks.com/matlabcentral/fileexchange/38584-butterworth-filters), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2011a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Butterworth에 대해 자세히 알아보기
도움

줌: filter1, plotpsd

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.3.0.0

Clarified in the text that the Signal Processing Toolbox is required.

1.2.0.0

Clarified that the signal processing toolbox is required.

1.1.0.0

fixed typo in description text.

1.0.0.0