?? ex082900.m
字號:
% Chapter 8: Example 8.29
% Elliptic Bandpass Filter Design:
% Use of the ELLIP function
%
% 第八章: 例 8.29
% 橢圓帶通濾波器設計
% ELLIP函數的應用
%
% 數字低通濾波器指標: % 橢圓型帶通:
ws = [0.3*pi 0.75*pi]; % 數字阻帶邊緣頻率
wp = [0.4*pi 0.6*pi]; % 數字通帶邊緣頻率
Rp = 1; % 通帶波動(dB)
As = 40; % 阻帶衰減(dB)
Ripple = 10 ^ (-Rp/20); % 通帶波動
Attn = 10 ^ (-As/20); % 阻帶衰減
% 計算橢圓濾波器參數:
[N,wn] = ellipord(wp/pi,ws/pi,Rp,As);
% 數字橢圓濾波器設計:
[b,a] = ellip(N,Rp,As,wn);
% 級聯型式實現:
[b0,B,A] = dir2cas(b,a)
%%b0 = 0.0197
%%B = 1.0000 1.5066 1.0000
%% 1.0000 0.9268 1.0000
%% 1.0000 -0.9268 1.0000
%% 1.0000 -1.5066 1.0000
%%A = 1.0000 0.5963 0.9399
%% 1.0000 0.2774 0.7929
%% 1.0000 -0.2774 0.7929
%% 1.0000 -0.5963 0.9399
%繪圖:
figure(1); subplot(1,1,1)
[db,mag,pha,grd,w] = freqz_m(b,a);
subplot(2,2,1);plot(w/pi,mag);grid;title('幅度響應')
xlabel(''); axis([0, 1, 0, 1])
set(gca,'XTickMode','manual','XTick',[0;0.3;0.4;0.6;0.75;1])
set(gca,'YTickMode','manual','YTick',[0,Ripple,1]);
subplot(2,2,3);plot(w/pi,db);grid;title('幅度(dB)')
xlabel('數字頻率(單位:pi)'); axis([0 1 -50 0]);
set(gca,'XTickMode','manual','XTick',[0;0.3;0.4;0.6;0.75;1])
set(gca,'YTickMode','manual','YTick',[-40;0])
set(gca,'YTickLabelMode','manual','YTickLabels',['40';' 0'])
subplot(2,2,2);plot(w/pi,pha/pi);grid;title('相位響應')
xlabel('');ylabel('相位(單位:pi)')
set(gca,'XTickMode','manual','XTick',[0;0.3;0.4;0.6;0.75;1])
subplot(2,2,4);plot(w/pi,grd);grid;title('群延遲')
xlabel('數字頻率(單位:pi)'); ylabel('樣本')
set(gca,'XTickMode','manual','XTick',[0;0.3;0.4;0.6;0.75;1])
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -