代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 8.28 \n\n'); banner();
%% ------------------------------------------------------------------------ Fp = 500; % analog passband freq in Hz
Fs = 700; % analog stopband freq in Hz
fs = 2000; % sampling rate in Hz % -------------------------------
% ω = ΩT = 2πF/fs
% Digital Filter Specifications:
% -------------------------------
wp = 2*pi*Fp/fs; % digital passband freq in rad/sec
%wp = Fp;
ws = 2*pi*Fs/fs; % digital stopband freq in rad/sec
%ws = Fs;
Rp = 0.5; % passband ripple in dB
As = 40; % stopband attenuation in dB Ripple = 10 ^ (-Rp/20) % passband ripple in absolute
Attn = 10 ^ (-As/20) % stopband attenuation in absolute % Analog prototype specifications: Inverse Mapping for frequencies
T = 1/fs; % set T = 1
OmegaP = wp/T; % prototype passband freq
OmegaS = ws/T; % prototype stopband freq % Analog Chebyshev-1 Prototype Filter Calculation:
[cs, ds] = afd_chb1(OmegaP, OmegaS, Rp, As); % Calculation of second-order sections:
fprintf('\n***** Cascade-form in s-plane: START *****\n');
[CS, BS, AS] = sdir2cas(cs, ds)
fprintf('\n***** Cascade-form in s-plane: END *****\n'); % Calculation of Frequency Response:
[db_s, mag_s, pha_s, ww_s] = freqs_m(cs, ds, 2*pi/T); % Calculation of Impulse Response:
[ha, x, t] = impulse(cs, ds); % Match-z Transformation:
%[b, a] = imp_invr(cs, ds, T) % digital Num and Deno coefficients of H(z)
[b, a] = mzt(cs, ds, T) % digital Num and Deno coefficients of H(z)
[C, B, A] = dir2par(b, a) % Calculation of Frequency Response:
[db, mag, pha, grd, ww] = freqz_m(b, a); %% -----------------------------------------------------------------
%% Plot
%% -----------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'Problem 8.28 Analog Chebyshev-1 lowpass')
set(gcf,'Color','white');
M = 1.2; % Omega max subplot(2,2,1); plot(ww_s/(pi*1000), mag_s); grid on; axis([-1.5, 1.5, 0, 1.1]);
xlabel(' Analog frequency in k\pi units'); ylabel('|H|'); title('Magnitude in Absolute');
set(gca, 'XTickMode', 'manual', 'XTick', [-700, -500, 0, 500, 700, 1000]*0.002);
set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.01, 0.5, 0.9441, 1]); subplot(2,2,2); plot(ww_s/(pi*1000), db_s); grid on; %axis([0, M, -50, 10]);
xlabel('Analog frequency in k\pi units'); ylabel('Decibels'); title('Magnitude in dB ');
set(gca, 'XTickMode', 'manual', 'XTick', [-700, -500, 0, 500, 700, 1000]*0.002);
set(gca, 'YTickMode', 'manual', 'YTick', [-70, -40, -1, 0]);
set(gca,'YTickLabelMode','manual','YTickLabel',['70';'40';' 1';' 0']); subplot(2,2,3); plot(ww_s/(pi*1000), pha_s/pi); grid on; axis([-1.5, 1.5, -1.2, 1.2]);
xlabel('Analog frequency in k\pi nuits'); ylabel('radians'); title('Phase Response');
set(gca, 'XTickMode', 'manual', 'XTick', [-700, -500, 0, 500, 700, 1000]*0.002);
set(gca, 'YTickMode', 'manual', 'YTick', [-1:0.5:1]); subplot(2,2,4); plot(t, ha); grid on; %axis([0, 30, -0.05, 0.25]);
xlabel('time in seconds'); ylabel('ha(t)'); title('Impulse Response'); figure('NumberTitle', 'off', 'Name', 'Problem 8.28 Digital Chebyshev-1 lowpass')
set(gcf,'Color','white');
M = 2; % Omega max %% Note %%
%% Magnitude of H(z) * T
%% Note %%
subplot(2,2,1); plot(ww/pi, mag/10); grid on; axis([0, M, 0, 1.1]);
xlabel(' frequency in \pi units'); ylabel('|H|'); title('Magnitude Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.5, 0.7, 1.0, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.01, 0.5, 0.9441, 1, 5, 10]); subplot(2,2,2); plot(ww/pi, pha/pi); axis([0, M, -1.1, 1.1]); grid on;
xlabel('frequency in \pi nuits'); ylabel('radians in \pi units'); title('Phase Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.5, 0.7, 1.0, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-1:1:1]); subplot(2,2,3); plot(ww/pi, db); axis([0, M, -70, 10]); grid on;
xlabel('frequency in \pi units'); ylabel('Decibels'); title('Magnitude in dB ');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.5, 0.7, 1.0, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-50, -40, -1, 0]);
set(gca,'YTickLabelMode','manual','YTickLabel',['50';'40';' 1';' 0']); subplot(2,2,4); plot(ww/pi, grd); grid on; %axis([0, M, 0, 35]);
xlabel('frequency in \pi units'); ylabel('Samples'); title('Group Delay');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.5, 0.7, 1.0, M]);
%set(gca, 'YTickMode', 'manual', 'YTick', [0:5:35]); figure('NumberTitle', 'off', 'Name', 'Problem 8.28 Pole-Zero Plot')
set(gcf,'Color','white');
zplane(b,a);
title(sprintf('Pole-Zero Plot'));
%pzplotz(b,a); % Calculation of Impulse Response:
%[hs, xs, ts] = impulse(c, d);
figure('NumberTitle', 'off', 'Name', 'Problem 8.28 Imp & Freq Response')
set(gcf,'Color','white');
t = [0:0.0005:0.04]; subplot(2,1,1); impulse(cs,ds,t); grid on; % Impulse response of the analog filter
axis([0, 0.04, -500, 1000]);hold on n = [0:1:0.04/T]; hn = filter(b,a,impseq(0,0,0.04/T)); % Impulse response of the digital filter
stem(n*T,hn); xlabel('time in sec'); title (sprintf('Impulse Responses, T=%.4f',T));
hold off %n = [0:1:29];
%hz = impz(b, a, n); % Calculation of Frequency Response:
[dbs, mags, phas, wws] = freqs_m(cs, ds, 2*pi/T); % Analog frequency s-domain [dbz, magz, phaz, grdz, wwz] = freqz_m(b, a); % Digital z-domain %% -----------------------------------------------------------------
%% Plot
%% ----------------------------------------------------------------- M = 1/T; % Omega max subplot(2,1,2); plot(wws/(2*pi),mags*Fs,'b', wwz/(2*pi)*Fs,magz,'r'); grid on; xlabel('frequency in Hz'); title('Magnitude Responses'); ylabel('Magnitude'); text(1.4,.5,'Analog filter'); text(1.5,1.5,'Digital filter');

  运行结果:

转换成绝对指标

模拟Chebyshev-1型低通滤波器,系统函数串联形式

通过match-z方法,模拟低通转换成数字Chebyshev-1型低通滤波器,

数字Chebyshev-1型低通直接形式的系数

转换成并联形式,其系数

模拟低通的幅度谱、相位谱和脉冲响应

数字低通的幅度谱、相位谱和群延迟

数字低通的零极点图,可以看出,零极点都位于单位圆内。

match-z方法,是和脉冲响应不变法不同的,不保留脉冲响应的形式,模拟Chebyshev-1型低通滤波器和对应的数字低通

滤波器的脉冲响应形式是不同的,见下图。

《DSP using MATLAB》Problem 8.28的更多相关文章

  1. 《DSP using MATLAB》Problem 5.28

    昨晚手机在看X信的时候突然黑屏,开机重启都没反应,今天维修师傅说使用时间太长了,还是买个新的吧,心疼银子啊! 这里只放前两个小题的图. 代码: 1. %% ++++++++++++++++++++++ ...

  2. 《DSP using MATLAB》Problem 7.28

    又是一年五一节,朋友圈都是晒名山大川的,晒脑袋的,我这没钱的待在家里上网转转吧 频率采样法设计带通滤波器,过渡带中有一个样点 代码: %% ++++++++++++++++++++++++++++++ ...

  3. 《DSP using MATLAB》Problem 7.36

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  4. 《DSP using MATLAB》Problem 7.27

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  5. 《DSP using MATLAB》Problem 7.26

    注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...

  6. 《DSP using MATLAB》Problem 7.25

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  7. 《DSP using MATLAB》Problem 7.24

    又到清明时节,…… 注意:带阻滤波器不能用第2类线性相位滤波器实现,我们采用第1类,长度为基数,选M=61 代码: %% +++++++++++++++++++++++++++++++++++++++ ...

  8. 《DSP using MATLAB》Problem 7.23

    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...

  9. 《DSP using MATLAB》Problem 7.16

    使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

随机推荐

  1. foreach循环的简单写法

    简单的foreach循环写法: pickedItems.ForEach(item => { this.List.Remove(item); }); //注意,List 必须和pickedItem ...

  2. java日期格式汇总

    日期格式汇总 转载 2017年05月23日 17:22:25 DateFormat     java.text.DateFormat public abstract class DateFormat ...

  3. PokerNet-poker recognition: 基于人工神经网络的扑克识别 (5)

    结果解读 结果1 结果2 结果1 void computeBCValue(cv::Mat mat_img, std::vector<bbox_t> result_vec, std::vec ...

  4. Git 如何使用ssh上传或者同步/下载项目到github

    上传本地代码及更新代码到GitHub教程 上传本地代码 第一步:去github上创建自己的Repository,创建页面如下图所示: 红框为新建的仓库的https地址 第二步: echo " ...

  5. Spring知识点整理

    1.bean什么时候被实例化 第一:如果你使用BeanFactory作为Spring Bean的工厂类,则所有的bean都是在第一次使用该Bean的时候实例化第二:如果你使用ApplicationCo ...

  6. [转]MySQL InnoDB引擎索引长度受限怎么办

    mysql> CREATE TABLE `tb` (-> `a` varchar(255) DEFAULT NULL,-> `b` varchar(255) DEFAULT NULL ...

  7. thinkphp 系统流程

    用户URL请求 调用应用入口文件(通常是网站的index.php) 载入框架入口文件(ThinkPHP.php) 记录初始运行时间和内存开销 系统常量判断及定义 载入框架引导类(Think\Think ...

  8. gitbook新版本"gitbook build"命令导出的html不能跳转的解决办法

    使用的是win7系统,gitbook新版本不支持html跳转功能,所以要降版本至2.6.7 解决办法如下: 第一步: 生成时指定gitbook的版本, 本地没有会先下载 gitbook build - ...

  9. 暴力贪心+预处理自动机——cf990E

    枚举每种灯管,然后找到代价最小的那种灯管 贪心策略:灯管从0开始向右放置,如果末尾是不能放置灯管的结点,那么要往回找到最近一个可以放置灯管的结点,在那里放置灯管 所以先预处理每个不能放置灯管的结点对应 ...

  10. 线段树区间合并+k维空间的曼哈顿距离——cf1093G好题

    和去年多校的CSGO一样,用状态压缩来求Manhattan距离的最大值 然后要用线段树维护一下区间最大值 /* k维空间给定n个点,两个操作 1 i b1 b2 .. bk : 修改第i个点的坐标 2 ...