?? ex082800.m
字號:
% 第八章: 例 8.28
% 切比雪夫-1高通濾波器設計
% CHEBY1函數的應用
%
% 數字低通濾波器指標: % 切比雪夫-1型高通:
ws = 0.4586*pi; % 數字阻帶邊緣頻率
wp = 0.6*pi; % 數字通帶邊緣頻率
Rp = 1; % 通帶波動(dB)
As = 15; % 阻帶衰減(dB)
Ripple = 10 ^ (-Rp/20); % 通帶波動
Attn = 10 ^ (-As/20); % 阻帶衰減
% 計算切比雪夫-1濾波器參數
[N,wn] = cheb1ord(wp/pi,ws/pi,Rp,As);
% 數字切比雪夫-1高通濾波器設計:
[b,a] = cheby1(N,Rp,wn,'high');
% 級聯型式實現:
[b0,B,A] = dir2cas(b,a)
%%b0 = 0.0243
%%B = 1.0000 -1.9991 0.9991
%% 1.0000 -2.0009 1.0009
%%A = 1.0000 1.0416 0.4019
%% 1.0000 0.5561 0.7647
% 繪圖:
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;ws/pi;wp/pi;1])
set(gca,'XTickLabelMode','manual','XTickLabels',[' 0 ';'0.46';'0.6 ';' 1 '])
set(gca,'YTickMode','manual','YTick',[0;Attn;Ripple;1])
subplot(2,2,3);plot(w/pi,db);grid;title('幅度(單位:dB)')
xlabel('數字頻率(單位:pi)'); axis([0,1,-30, 0]);
ylabel('分貝數')
set(gca,'XTickMode','manual','XTick',[0;ws/pi;wp/pi;1])
set(gca,'XTickLabelMode','manual','XTickLabels',[' 0 ';'0.46';'0.6 ';' 1 '])
set(gca,'YTickMode','manual','YTick',[-30;-As;-Rp;0])
set(gca,'YTickLabelMode','manual','YTickLabels',['30';'15';' 1';' 0'])
subplot(2,2,2);plot(w/pi,pha/pi);grid;title('相位響應')
xlabel('');ylabel('相位(單位:pi)'); axis([0,1,-1,1])
set(gca,'XTickMode','manual','XTick',[0;ws/pi;wp/pi;1])
set(gca,'XTickLabelMode','manual','XTickLabels',[' 0 ';'0.46';'0.6 ';' 1 '])
subplot(2,2,4);plot(w/pi,grd);grid;title('群延遲')
xlabel('數字頻率(單位:pi)');
ylabel('延遲(單位:樣本數)')
set(gca,'XTickMode','manual','XTick',[0;ws/pi;wp/pi;1])
set(gca,'XTickLabelMode','manual','XTickLabels',[' 0 ';'0.46';'0.6 ';' 1 '])
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -