Matlab freqs 函数
freqs
模拟滤波器的频率响应
语法:
h = freqs(b,a,w)
[h,w] = freqs(b,a)
[h,w] = freqs(b,a,f)
freqs(b,a)
描述:
freqs 返回一个模拟滤波器的H(jw)的复频域响应(拉普拉斯格式)
请给出分子b和分母a
h = freqs(b, a, w) 根据系数向量计算返回模拟滤波器的复频域响应。freqs 计算在复平面虚轴上的频率响应h,角频率w确定了输入的实向量,因此必须包含至少一个频率点。
[h, w] = freqs(b, a) 自动挑选200个频率点来计算频率响应h
[h, w] = freqs(b, a, f) 挑选f个频率点来计算频率响应h
例子:
找到并画出下面传递函数的频率响应
Matlab代码:
a = [1 0.4 1];
b = [0.2 0.3 1];
w = logspace(-1, 1);
logspace 功能:生成从10的a次方到10的b次方之间按对数等分的n个元素的行向量。n如果省略,则默认值为50。
freqs(b, a, w);
You can also create the plot with:
h = freqs(b,a,w);
mag = abs(h);
phase = angle(h);
subplot(2,1,1), loglog(w,mag)
subplot(2,1,2), semilogx(w,phase)
To convert to hertz, decibels, and degrees, use:
f = w/(2*pi);
mag = 20*log10(mag);
phase = phase*180/pi;
算法:
freqs evaluates the polynomials at each frequency point, then divides the numerator response by the denominator response:
s = i*w;
h = polyval(b,s)./polyval(a,s)