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)