How to check the freqeuncy response of a boxcar filter?

24 次查看(过去 30 天)
Hi, I am performing a lowpass filtering with two different filters. a) window i.e. box car b) butter filter. For butter, I know how to see the frequency response, but how to see the freqeuncy response of boxcar filter?
clear all; clc;
fs =2000;
fc =20/(fs/2);
N = 1/fc;
h = boxcar(N); % 1/N = fc
h = h/sum(h);
%filtered_signal = filtfilt(h, 1, signal));
butter
clc; clear all;
fs = 2000;
filtorder = 6; bw_butter =20;
[bcoeff,acoeff] = butter(filtorder,bw_butter/fs*2);
figure()
freqz(bcoeff,acoeff,[],fs)
xlim([0 200])
%filtered_signal = filtfilt(bcoeff,acoeff, signal));

回答(1 个)

Chunru
Chunru 2023-8-15
clear all; clc;
fs =2000;
fc =20/(fs/2);
N = 1/fc;
h = boxcar(N); % 1/N = fc
h = h/sum(h);
bcoeff = h;
acoeff = 1;
freqz(bcoeff,acoeff,[],fs)
%xlim([0 200])

Community Treasure Hunt

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

Start Hunting!

Translated by