Matlab 3dB 12赫兹低通滤波器

时间:2013-06-23 21:11:37

标签: matlab filtering lowpass-filter

我正在寻找截止频率为12Hz的3dB低通滤波器。我知道Matlab有这个函数fdesign.lowpass,它应该可以是F3dbsource / additional)的3dB,但我还不确定如何实现它们,即:我应该包括哪些功能,哪些功能不包括在内。我对我认为不需要的所有其他变量感到困惑 - 我只需要Fc和3dB。我还发现fdatool但也不知道如何设置这样的过滤器。

数据包含常规的x和y值,而它是记录运动的速度与时间的关系曲线。

1 个答案:

答案 0 :(得分:1)

对于您的应用程序,我强烈建议您尝试使用普通的butterworth过滤器,Matlab语法为:

[b,a]=butter(n,Wn)

Wn是数字频率,所以这就是我的构成方式:

% assume x is time and y is speed
Ts = mean(diff(x));
Fs = 1/Ts;
% for butter, we need Wn, which is the cutoff frequency
% where 0.0 < Wn < 1.0, where 1.0 is half the sample rate
% The cutoff is the -3 dB point of the filter
% Wn = fCutOff/(Fs/2)
% for a cutoff of 12 Hz
fCutOff = 12/(Fs/2);
% we'll start with an order of 1 which should give us about 20 db/decade attenuation
[b,a] = butter(1,fCutoff);
% plot the filter frequency response to see what it looks like
% use 512 points to plot it
freqz(b,a,512,Fs)

但是,如果我理解正确的话,您将以大约66 Hz的频率对数据进行采样,这比您想要的截止频率快5倍。经验法则通常是10次,因此您可能不会对输出的结果感到满意。这是我的输出:results