《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 ...
随机推荐
- Angularjs 1.3在页面中输出带Html标记的文本
如何Angularjs1.3在页面中输出带Html标记的文本 基于安全考虑,Angularjs不允许用ng-bind或者{{}}的方法输出html文本. 在实际的应用中,比如信息管理系统,用在线编辑器 ...
- AutoCAD2016安装破解教程
AutoCAD2016安装破解教程.本人亲自实验,破解成功,有效.以64位为例. 工具/原料 笔记本电脑 AutoCAD2016安装包 AutoCAD2016注册机(xf-adsk2016_x64 ...
- 表单序列化+ajax跨域提交
php后台代码: use cmf\controller\HomeBaseController; use think\Db; header('Access-Control-Allow-Origin:*' ...
- jmeter 创建接口测试案例
1 怎么做接口测试? 一般情况下,由于我们项目前后调用主要是基于http协议的接口,所以测试接口时主要是通过工具或代码模拟http请求的发送和接收.所以我们下面整理了一下使用Jmeter工具进行htt ...
- Shell 编程综合案例
Shell编程综合案例 Shell也学习了大概的知识,现在这篇文章就大概讲述下如何使用shell编写一个脚本呢?下面就展示一个大家常用的数据库备份案例来进行展示. 需求分析 1)每天凌晨2:10分备份 ...
- 2018-2-13-win10-uwp-入门
title author date CreateTime categories win10 uwp 入门 lindexi 2018-2-13 17:23:3 +0800 2018-2-13 17:23 ...
- Eureka配置详解(转)
Eureka客户端配置 1.RegistryFetchIntervalSeconds 从eureka服务器注册表中获取注册信息的时间间隔(s),默认为30秒 2.InstanceInfoR ...
- ZF、TP、CI等各种框架的区别
(原标题:面试常见问题之ZF.TP.CI等框架的区别 http://blog.163.com/m13341159039_1/blog/static/245953061201522092212820/) ...
- Go 逻辑运算符
Go 逻辑运算符 package main import "fmt" func main() { var a bool = true var b bool = false if ( ...
- 【基础】Hint控制语句执行
mysql常用的hint对于经常使用oracle的朋友可能知道,oracle的hint功能种类很多,对于优化sql语句提供了很多方法.同样,在mysql里,也有类似的hint功能.下面介绍一些常用的. ...