代码:

%% ------------------------------------------------------------------------
%% 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的更多相关文章

  1. 《DSP using MATLAB》Problem 8.42

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  2. 《DSP using MATLAB》Problem 8.40

    代码: function [wpLP, wsLP, alpha] = bs2lpfre(wpbs, wsbs) % Band-edge frequency conversion from bandst ...

  3. 《DSP using MATLAB》Problem 8.30

    10月1日,新中国70周岁生日,上午观看了盛大的庆祝仪式,整齐的方阵,先进的武器,尊敬的先辈英雄,欢乐的人们,愿我们的 国家越来越好,人民生活越来越好. 接着做题. 代码: %% ---------- ...

  4. 《DSP using MATLAB》Problem 7.33

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

  5. 《DSP using MATLAB》Problem 7.27

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

  6. 《DSP using MATLAB》Problem 7.26

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

  7. 《DSP using MATLAB》Problem 7.25

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

  8. 《DSP using MATLAB》Problem 7.24

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

  9. 《DSP using MATLAB》Problem 7.23

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

随机推荐

  1. vue2 核心概念

    一.vue变量 所有的 vue变量 ,必须在data:中有注册(哪怕内容是空,相当于声明这个是变量,是vue变量而不是js变量).这里的变量也可以运算.(注意:所有的框架一定要注意js变量和框架的变量 ...

  2. STM32库中自定义的数据类型

    在头文件 <stdint.h> 中 1 /* exact-width signed integer types */ typedef signed char int8_t; typedef ...

  3. idea无法引用jar包中的class

    最近由eclipse换idea的过程中,出现了一个很奇妙的问题! 项目是maven+git+idea管理的,idea某次在使用的过程中,电脑死机重启后,发现无法引用jar包中的class.包括jdk中 ...

  4. 【React-Native】---Android环境配置

    一.前言 本文主要内容是在Window系统下配置Android APP的开发环境,要配置RN的Android开发环境需要3个依赖 1.JDK(版本必须是 1.8) 2.Node(版本必须高于8.3) ...

  5. babel/core 6.x升级到7.x要碰到的一些坑

    刚学习react.js没多久,碰到各种坑.就比如这个问题,弄了我3个小时,终于解决了.其实就是一个小问题. 报错信息: Error: Cannot find module '@babel/core' ...

  6. kafka单机版的安装、集群部署 及使用

    1.安装kafka(单机版) 1.1上传 kafka_2.11-2.0.0.tgz 到 /root/Downloads 1.2解压 tar 包 tar -zxvf kafka_2.11-2.0.0.t ...

  7. centos7升级php5.4到php5.6

    history命令历史 8 yum provides php #自带的只有5.4版本 9 rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-relea ...

  8. cdh5.47 上配置flume

    flume 配置文件 # Define a memory channel called ch1 on agent1agent1.channels.ch1.type = memoryagent1.cha ...

  9. git常用操作笔记

    这是我看了廖雪峰的git教程,写的笔记,仅作为一个学习的记录 一.大多数我们面临的是已经有一个进行中的项目了,我们只需克隆下来就可以了 1.安装git,安装完后,可输入git,回车,查看是否已安装 2 ...

  10. 大道浮屠诀---NBU7.7.3_oracle11G单机-单机(异机恢复WINDOWS2008平台)

    现有环境说明: 一台WINDOWS2008R2:安装有NBU7.7.3,作为服务端 一台WINDOWS2008R2:安装有oracle11.2.0.3,作为数据库服务器 现假设数据库意外崩溃,需要进行 ...