《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窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- I/O复用select 使用简介
一:五种I/O模型区分: 1.阻塞I/O模型 最流行的I/O模型是阻塞I/O模型,缺省情形下,所有套接口都是阻塞的.我们以数据报套接口为例来讲解此模型(我们使用UDP而不是TCP作为例子的原 ...
- java IO 流小结
java IO 流小结 java流类图结构 流的分类 按方向 输入流 输出流 按类型 字节流 字符流 结论:只要是处理纯文本数据,就优先考虑使用字符流. 除此之外都使用字节流.
- webogic基本使用
文章目录 启动 注入 部署应用: 访问 启动 /root/Oracle/Middleware/user_projects/domains/weblogic/bin/startWebLogic.sh 上 ...
- flink中对于window和watermark的一些理解
package com.chenxiang.flink.demo; import java.io.IOException; import java.net.ServerSocket; import j ...
- UVA 10242 Fourth Point
题意:给你平行四边形两条边的顶点,让你求第四个点. 思路:要找到俩边的公共点,然后向量运算. AC代码: #include<cstdio> #include<cmath> #i ...
- C语言——二维数组
目录 二维数组 一.二维数组的定义 二.二维数组的初始化 三.通过赋初值定义二维数组的大小 四.二维数组与指针 二维数组 一.二维数组的定义 类型名 数组名[ 常量表达式1 ][ 常量表达式2 ] i ...
- 前端(十三)—— JavaScript高级:回调函数、闭包、循环绑定、面向对象、定时器
回调函数.闭包.循环绑定.面向对象.定时器 一.函数高级 1.函数回调 // 回调函数 function callback(data) {} // 逻辑函数 function func(callbac ...
- js导出复杂表头(多级表头)的excel
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- spring boot Swagger2(version=2.7.0) 注解@ApiImplicitParam的属性dataType值为”自定义泛型“应用
注解: @ApiImplicitParams @ApiImplicitParam name="需注解的API输入参数", value="接收参数的意义描述" ...
- iOS组件化开发-CocoaPods安装
首先要检查Mac是否安装了rvm(ruby version manager).打开终端,输入指令$ rvm -v ,若没有安装 curl -L https://get.rvm.io | bash -s ...