【发布时间】:2015-07-18 09:01:58
【问题描述】:
我试图绘制我的序列在被巴特沃斯低通滤波器滤波时的频率响应。我的极点和零图计算得很好,但似乎无法正确绘制我的频率响应。当我这样做时,我的轴总是超出比例。我试过使用 Matlab 的 bode 函数无济于事。我一直在使用的示例输入类似于buttdes(1000, 2500, -3, -20, 20000)。任何帮助深表感谢!!到目前为止,这是我的代码:
function buttdes(fpass, fstop, dp, ds, fs)
%// Design a discrete-time Butterworth filter
%// BUTTDES(fpass, fstop, dp, ds, fs) designs and plots the bode plot
%// of the resulting analog-equivalent filter that has been
%// designed to match the analog parameters fpass (in Hz),
%// fstop (in Hz), dp (in dB) and ds (in dB).
%// fs is the sample rate in Hz
wp = fpass/fs;
ws = fstop/fs;
WpT = 2 * tan(wp / 2);
WsT = 2 * tan(ws / 2);
qp = log10(10^-(dp/10)-1);
qs = log10(10^-(ds/10)-1);
N = ceil((qs-qp) / 2 / log10(WsT / WpT));
WcT = WpT * 10^(-qp/2/N);
k = 0:N-1;
skT = WcT * exp(j*pi*(2*k+N+1)/2/N);
b = real(prod(skT./(skT -2))) * poly(-ones(1, N));
a = real(poly(-(skT+2)./(skT-2)));
zplane(b, a);
【问题讨论】:
-
@Benoit_11 zplane 是我的零极点图。
-
您是如何尝试绘制频率响应的? freqz(b,a) 工作正常。
-
@Navan 抱歉回复晚了。我尝试使用频率。但我的轴仍然没有正确格式化
标签: matlab plot filtering frequency