《DSP using MATLAB》Problem 8.44


代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 8.44.4 \n\n'); banner();
%% ------------------------------------------------------------------------
%%
%% Chebyshev-1 bandpass and highpass, parallel form,
%% by MATLAB toolbox function
%%
%% ------------------------------------------------------------------------ %--------------------------------------------------------
% PART1 bandpass
% Digital Filter Specifications: Chebyshev-1 bandpass
% -------------------------------------------------------
wsbp = [0.10*pi 0.60*pi]; % digital stopband freq in rad
wpbp = [0.20*pi 0.50*pi]; % digital passband freq in rad delta1 = 0.1;
delta2 = 0.01; Ripple = 1-delta1; % passband ripple in absolute
Attn = delta2; % stopband attenuation in absolute Rp = -20*log10(Ripple); % passband ripple in dB
As = -20*log10(Attn); % stopband attenuation in dB % Calculation of Chebyshev-1 filter parameters:
[N, wn] = cheb1ord(wpbp/pi, wsbp/pi, Rp, As);
fprintf('\n ********* Chebyshev-1 Digital Bandpass Filter Order is = %3.0f \n', 2*N) % Digital Chebyshev-1 Bandpass Filter Design:
fprintf('\n*******Digital bandpass, Coefficients of DIRECT-form***********\n');
[bbp, abp] = cheby1(N, Rp, wn) [C, B, A] = dir2cas(bbp, abp); % Calculation of Frequency Response:
[dbbp, magbp, phabp, grdbp, wwbp] = freqz_m(bbp, abp); % -----------------------------------------------------
% PART2 highpass
% Digital Highpass Filter Specifications:
% -----------------------------------------------------
wphp = 0.8*pi; % digital passband freq in rad
wshp = 0.7*pi; % digital stopband freq in rad delta1 = 0.05;
delta2 = 0.01; Ripple = 0.5-delta1; % passband ripple in absolute
Attn = delta2; % stopband attenuation in absolute Rp = -20*log10(Ripple/0.5); % passband ripple in dB
As = -20*log10(Attn/0.5); % stopband attenuation in dB % Calculation of Chebyshev-1 hp filter parameters:
[N, wn] = cheb1ord(wphp/pi, wshp/pi, Rp, As);
fprintf('\n********** Chebyshev-1 Digital Highpass Filter Order = %3.0f \n', N) % Digital Chebyshev-1 Highpass Filter Design:
fprintf('\n*******Digital Highpass, Coefficients of DIRECT-form***********\n');
[bhp, ahp] = cheby1(N, Rp, wn, 'high')
[C, B, A] = dir2cas(bhp*0.5, ahp); % Calculation of Frequency Response:
[dbhp, maghp, phahp, grdhp, wwhp] = freqz_m(bhp*0.5, ahp); % ---------------------------------------------
% PART3 parallel form of bp and hp
% ---------------------------------------------
abp;
bbp;
ahp;
bhp; a = conv(2*abp, ahp)
b = conv(2*bbp, ahp) + conv(bhp, abp)
[C, B, A] = dir2cas(b, a) % Calculation of Frequency Response:
[db, mag, pha, grd, ww] = freqz_m(b, a); %% -----------------------------------------------------------------
%% Plot
%% ----------------------------------------------------------------- figure('NumberTitle', 'off', 'Name', 'Problem 8.44.4 combination of Chebyshev-1 bp and hp, by MATLAB cheby1 function')
set(gcf,'Color','white');
M = 1; % Omega max subplot(2,2,1); plot(ww/pi, mag); axis([0, M, 0, 1.2]); grid on;
xlabel('Digital frequency in \pi units'); ylabel('|H|'); title('Magnitude Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, wsbp(1)/pi, wpbp/pi, wsbp(2)/pi, wshp/pi, wphp/pi, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.01, 0.45, 0.5, 0.9, 1]); subplot(2,2,2); plot(ww/pi, db); axis([0, M, -100, 2]); grid on;
xlabel('Digital frequency in \pi units'); ylabel('Decibels'); title('Magnitude in dB');
set(gca, 'XTickMode', 'manual', 'XTick', [0, wsbp(1)/pi, wpbp/pi, wsbp(2)/pi, wshp/pi, wphp/pi, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-76, -46, -41, -1, 0]);
set(gca,'YTickLabelMode','manual','YTickLabel',['76'; '46'; '41';'1 ';' 0']); subplot(2,2,3); plot(ww/pi, pha/pi); axis([0, M, -1.1, 1.1]); grid on;
xlabel('Digital frequency in \pi nuits'); ylabel('radians in \pi units'); title('Phase Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, wsbp(1)/pi, wpbp/pi, wsbp(2)/pi, wshp/pi, wphp/pi, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-1:0.5:1]); subplot(2,2,4); plot(ww/pi, grd); axis([0, M, 0, 80]); grid on;
xlabel('Digital frequency in \pi units'); ylabel('Samples'); title('Group Delay');
set(gca, 'XTickMode', 'manual', 'XTick', [0, wsbp(1)/pi, wpbp/pi, wsbp(2)/pi, wshp/pi, wphp/pi, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0:20:80]); figure('NumberTitle', 'off', 'Name', 'Problem 8.44.4 Pole-Zero Plot')
set(gcf,'Color','white');
zplane(b, a);
title(sprintf('Pole-Zero Plot'));
%pzplotz(b,a); figure('NumberTitle', 'off', 'Name', 'Problem 8.44.4 combination of Chebyshev-1 bp and hp, by MATLAB cheby1 function')
set(gcf,'Color','white');
M = 1; % Omega max %subplot(2,2,1);
plot(ww/pi, mag); axis([0, M, 0, 1.2]); grid on;
xlabel('Digital frequency in \pi units'); ylabel('|H|'); title('Magnitude Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, wsbp(1)/pi, wpbp/pi, wsbp(2)/pi, wshp/pi, wphp/pi, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.01, 0.45, 0.5, 0.9, 1]);
运行结果:
看设计要求,是Chebyshev-1型数字带通和高通滤波器的组合,首先计算带通。
系统函数直接形式系数如下:


其次计算高通,系统函数直接形式系数如下:

再次,前面计算完高通和带通后,二者进行并联组合。等效滤波器的系统函数,直接形式系数如下:

串联形式的系数如下:

零极点图

等效滤波器的幅度谱,相关幅度值、频带边界频率画出直线,如下图

《DSP using MATLAB》Problem 8.44的更多相关文章
- 《DSP using MATLAB》Problem 8.42
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 8.40
代码: function [wpLP, wsLP, alpha] = bs2lpfre(wpbs, wsbs) % Band-edge frequency conversion from bandst ...
- 《DSP using MATLAB》Problem 8.30
10月1日,新中国70周岁生日,上午观看了盛大的庆祝仪式,整齐的方阵,先进的武器,尊敬的先辈英雄,欢乐的人们,愿我们的 国家越来越好,人民生活越来越好. 接着做题. 代码: %% ---------- ...
- 《DSP using MATLAB》Problem 7.33
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.27
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.26
注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.25
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.24
又到清明时节,…… 注意:带阻滤波器不能用第2类线性相位滤波器实现,我们采用第1类,长度为基数,选M=61 代码: %% +++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.23
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...
随机推荐
- NX二次开发-NXOpen::CoordinateSystemCollection Class Reference
NX11+VS2013 #include <NXOpen/Section.hxx> #include <NXOpen/SectionCollection.hxx> #inclu ...
- php中正则表达式总结(不容错过)
php中正则表达式总结(不容错过) 一.总结 一句话总结: 无论js,php,java,python里面中的正则都是差不多一样的,所以用点脑子 用到正则的地方很多,比如 nginx的配置文件 1.ph ...
- Dubbo入门到精通学习笔记(九):简易版支付系统介绍、部署(单节点)
文章目录 部署(单节点) 一.前期准备 二.对部署环境进行规划 创建数据库 调整公共配置文件 应用部署前期准备 部署服务 部署 Web 应用 部署定时任务 一. 工程结构 第三方支付系统架构 pay- ...
- es概念一句话简介和注意点
1.elasticsearch是什么? 一个实时分布式搜索(全文or结构化)和分析引擎,面向文档(document oriented) 2.主节点(Master Node)职责? 负责集群中的操作(如 ...
- Aggregate report 聚合报告
- transport error 202: bind failed: Address already in use
background: I have terminated some test debugger without properly saying goodbye. the JDWP didn't cl ...
- PHP之如何编写一个Vue的API后台(一)
首先我们先建立文件的结构 如下图: components - 存放所有的全局方法,比如:autoplay的函数 lib - 所有第三方的方法 比如:DBTool:数据库的方法 logs - 日志 ...
- Oracle数据库与MySQL的不同点
Oracle笔记 一. Oracle的启动和登录: 1.启动:通过启动Oracle的服务启动. OracleServiceORCL:核心服务,必须启动. OracleOraDb11g_home1 ...
- iOS组件化开发-CocoaPods安装
首先要检查Mac是否安装了rvm(ruby version manager).打开终端,输入指令$ rvm -v ,若没有安装 curl -L https://get.rvm.io | bash -s ...
- 笔记30 视图解析 ——TilesViewResolver
Apache Tiles,定义适用于所有页面 的通用页面布局.Spring MVC以视图解析器的形式为Apache Tiles提 供了支持,这个视图解析器能够将逻辑视图名解析为Tile定义. 1.配 ...