《DSP using MATLAB》Problem 8.45


代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 8.45.4 \n\n'); banner();
%% ------------------------------------------------------------------------
%%
%% Chebyshev-1 bandpass and lowpass, parallel form,
%% by toolbox function in MATLAB,
%%
%% ------------------------------------------------------------------------ %--------------------------------------------------------
% PART1 bandpass
% Digital Filter Specifications: Chebyshev-1 bandpass
% -------------------------------------------------------
wsbp = [0.40*pi 0.90*pi]; % digital stopband freq in rad
wpbp = [0.60*pi 0.80*pi]; % digital passband 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 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:
[bbp, abp] = cheby1(N, Rp, wn); [C, B, A] = dir2cas(0.5*bbp, abp) % Calculation of Frequency Response:
[dbbp, magbp, phabp, grdbp, wwbp] = freqz_m(0.5*bbp, abp); % -----------------------------------------------------
% PART2 lowpass
% Digital Highpass Filter Specifications:
% -----------------------------------------------------
wslp = 0.40*pi; % digital stopband freq in rad
wplp = 0.30*pi; % digital passband freq in rad delta1 = 0.10;
delta2 = 0.01; Ripple = 1.0-delta1; % passband ripple in absolute
Attn = delta2; % stopband attenuation in absolute Rp = -20*log10(Ripple/1.0); % passband ripple in dB
As = -20*log10(Attn/1.0); % stopband attenuation in dB % Calculation of Chebyshev-1 filter parameters:
[N, wn] = cheb1ord(wplp/pi, wslp/pi, Rp, As); fprintf('\n ********* Chebyshev-1 Digital Lowpass Filter Order is = %3.0f \n', N) % Digital Chebyshev-1 lowpass Filter Design:
[blp, alp] = cheby1(N, Rp, wn); [C, B, A] = dir2cas(blp, alp) % Calculation of Frequency Response:
[dblp, maglp, phalp, grdlp, wwlp] = freqz_m(blp, alp); % ---------------------------------------------
% PART3 parallel form of bp and lp
% ---------------------------------------------
abp;
bbp;
alp;
blp; fprintf('\n ********* Chebyshev-1 Digital Lowpass parrell with Bandpass Filter *******\n');
fprintf('\n ********* Coefficients of Direct-Form: *******\n');
a = conv(2*abp, alp)
b = conv(bbp, alp) + conv(blp, 2*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.45.4 combination of Chebyshev-1 bp and lp, by cheby1 function in MATLAB')
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, wplp/pi, wsbp(1)/pi, wpbp/pi, wsbp(2)/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, wplp/pi, wsbp(1)/pi, wpbp/pi, wsbp(2)/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, wplp/pi, wsbp(1)/pi, wpbp/pi, wsbp(2)/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, wplp/pi, wsbp(1)/pi, wpbp/pi, wsbp(2)/pi, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0:20:80]); figure('NumberTitle', 'off', 'Name', 'Problem 8.45.4 combination of Chebyshev-1 bp and lp, by cheby1')
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, wplp/pi, wsbp(1)/pi, wpbp/pi, wsbp(2)/pi, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.01, 0.45, 0.5, 0.9, 1]); figure('NumberTitle', 'off', 'Name', 'Problem 8.45.4 Pole-Zero Plot')
set(gcf,'Color','white');
zplane(b, a);
title(sprintf('Pole-Zero Plot'));
%pzplotz(b,a);
运行结果:
看题目设计要求,是Chebyshev-1型低通和带通的组合。
我们先设计带通,系统函数串联形式的系数如下:

其次,Chebyshev-1型数字低通,阶数为7,系统函数串联形式的系数如下:

再次,低通和带通进行组合,等效滤波器的系统函数,直接形式和串联形式,系数分别如下:


等效滤波器,幅度谱如下,频带边界频率和指标画出直线,

幅度谱、相位谱和群延迟响应

零极点图

《DSP using MATLAB》Problem 8.45的更多相关文章
- 《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 ...
- 《DSP using MATLAB》Problem 7.15
用Kaiser窗方法设计一个台阶状滤波器. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.14
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.13
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.12
阻带衰减50dB,我们选Hamming窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- Sqli labs系列-less-2 详细篇
就今天晚上一个小插曲,瞬间感觉我被嘲讽了. SQL手工注入这个东西,杂说了吧,如果你好久不玩的话,一时说开了,你也只能讲个大概,有时候,长期不写写,你的构造语句还非常容易忘,要不我杂会被瞬间嘲讽了啊. ...
- ios移动输入框被软键盘遮挡
页面输入框会出现被软键盘挡住的问题: 解决方法:获取input点击事件设置body高度 $('input').bind('click',function(e){ var $this = $(this) ...
- B606 ChangeNet
@echo off Setlocal Enabledelayedexpansion title B606 ChangeNet echo Checking... set inside=F&set ...
- 23、css的定位问题
1.positon:relative相对定位 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" & ...
- UVA - 143 Orchard Trees (点在三角形内)
题意: 给出三角形的三个点的坐标(浮点数), 问落在三角形内及三角形边上的整点有多少? 思路:所有点暴力判断(点的范围1-99,三角形可能是0-100,因为这个WA了一下orz) AC代码: ...
- 【Java多线程系列五】列表类
一些列表类及其特性 类 线程安全 Iterator 特性 说明 Vector 是 fail-fast 内部方法用synchronized修饰,因此执行效率较低 1. 线程安全的列表类并不意味着调用它 ...
- struts基础2
Result配置详解 说明:在前面的许多案例中我们所用到的Action基本都继承自ActionSupport这个类,而在这个类中我们定义了五个字段:SUCCESS,NONE,ERROR,INPUT,L ...
- spring boot下WebSocket消息推送
WebSocket协议 WebSocket是一种在单个TCP连接上进行全双工通讯的协议.WebSocket通信协议于2011年被IETF定为标准RFC 6455,并由RFC7936补充规范.WebSo ...
- Python爬虫工程师必学APP数据抓取实战✍✍✍
Python爬虫工程师必学APP数据抓取实战 整个课程都看完了,这个课程的分享可以往下看,下面有链接,之前做java开发也做了一些年头,也分享下自己看这个视频的感受,单论单个知识点课程本身没问题,大 ...
- bigger is greater
题目: Lexicographical order is often known as alphabetical order when dealing with strings. A string i ...