下雨了,大风降温,一地树叶,终于进入冬季了

代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 8.46.4 \n\n'); banner();
%% ------------------------------------------------------------------------ % Digital Filter Specifications: Elliptic bandpass
wsbp = [0.30*pi 0.60*pi]; % digital stopband freq in rad
wpbp = [0.35*pi 0.50*pi]; % digital passband freq in rad
Rp = 1.00; % passband ripple in dB
As = 40; % stopband attenuation in dB Ripple = 10 ^ (-Rp/20) % passband ripple in absolute
Attn = 10 ^ (-As/20) % stopband attenuation in absolute fprintf('\n*******Digital bandpass, Coefficients of DIRECT-form***********\n');
[bbp, abp] = elipbpf(wpbp, wsbp, Rp, As)
[C, B, A] = dir2cas(bbp, abp) % Calculation of Frequency Response:
[dbbp, magbp, phabp, grdbp, wwbp] = freqz_m(bbp, abp); % ---------------------------------------------------------------
% find Actual Passband Ripple and Min Stopband attenuation
% ---------------------------------------------------------------
delta_w = 2*pi/1000;
Rp_bp = -(min(dbbp(ceil(wpbp(1)/delta_w+1):1:ceil(wpbp(2)/delta_w+1)))); % Actual Passband Ripple fprintf('\nActual Passband Ripple is %.4f dB.\n', Rp_bp); As_bp = -round(max(dbbp(1:1:ceil(wsbp(1)/delta_w)+1))); % Min Stopband attenuation
fprintf('\nMin Stopband attenuation is %.4f dB.\n\n', As_bp); %% -----------------------------------------------------------------
%% Plot
%% ----------------------------------------------------------------- figure('NumberTitle', 'off', 'Name', 'Problem 8.46.4 Elliptic bp by elipbpf function')
set(gcf,'Color','white');
M = 1; % Omega max subplot(2,2,1); plot(wwbp/pi, magbp); 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, 0.3, 0.35, 0.5, 0.6, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.01, 0.8913, 1]); subplot(2,2,2); plot(wwbp/pi, dbbp); 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, 0.3, 0.35, 0.5, 0.6, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-80, -40, -1, 0]);
set(gca,'YTickLabelMode','manual','YTickLabel',['80'; '40';'1 ';' 0']); subplot(2,2,3); plot(wwbp/pi, phabp/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, 0.3, 0.35, 0.5, 0.6, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-1:0.5:1]); subplot(2,2,4); plot(wwbp/pi, grdbp); axis([0, M, 0, 80]); grid on;
xlabel('Digital frequency in \pi units'); ylabel('Samples'); title('Group Delay');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.3, 0.35, 0.5, 0.6, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0:20:80]); figure('NumberTitle', 'off', 'Name', 'Problem 8.46.4 Pole-Zero Plot')
set(gcf,'Color','white');
zplane(bbp, abp);
title(sprintf('Pole-Zero Plot'));
%pzplotz(b,a); % -----------------------------------------------------
% method 3 elip function
% ----------------------------------------------------- % Calculation of Elliptic filter parameters:
[N, wn] = ellipord(wpbp/pi, wsbp/pi, Rp, As); fprintf('\n ********* Elliptic Digital Bandpass Filter Order is = %3.0f \n', 2*N) % Digital Elliptic Bandpass Filter Design:
[bbp, abp] = ellip(N, Rp, As, wn) [C, B, A] = dir2cas(bbp, abp) % Calculation of Frequency Response:
[dbbp, magbp, phabp, grdbp, wwbp] = freqz_m(bbp, abp); % ---------------------------------------------------------------
% find Actual Passband Ripple and Min Stopband attenuation
% ---------------------------------------------------------------
delta_w = 2*pi/1000;
Rp_bp = -(min(dbbp(ceil(wpbp(1)/delta_w+1):1:ceil(wpbp(2)/delta_w+1)))); % Actual Passband Ripple fprintf('\nActual Passband Ripple is %.4f dB.\n', Rp_bp); As_bp = -round(max(dbbp(1:1:ceil(wsbp(1)/delta_w)+1))); % Min Stopband attenuation
fprintf('\nMin Stopband attenuation is %.4f dB.\n\n', As_bp); %% -----------------------------------------------------------------
%% Plot
%% ----------------------------------------------------------------- figure('NumberTitle', 'off', 'Name', 'Problem 8.46.4 Elliptic bp by ellip function')
set(gcf,'Color','white');
M = 1; % Omega max subplot(2,2,1); plot(wwbp/pi, magbp); 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, 0.3, 0.35, 0.5, 0.6, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.01, 0.8913, 1]); subplot(2,2,2); plot(wwbp/pi, dbbp); 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, 0.3, 0.35, 0.5, 0.6, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-80, -40, -1, 0]);
set(gca,'YTickLabelMode','manual','YTickLabel',['80'; '40';'1 ';' 0']); subplot(2,2,3); plot(wwbp/pi, phabp/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, 0.3, 0.35, 0.5, 0.6, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-1:0.5:1]); subplot(2,2,4); plot(wwbp/pi, grdbp); axis([0, M, 0, 100]); grid on;
xlabel('Digital frequency in \pi units'); ylabel('Samples'); title('Group Delay');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.3, 0.35, 0.5, 0.6, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0:30:90]);

  运行结果:

看题目,是Elliptic型数字带通,设计指标,DB转换成绝对指标

Elliptic模拟低通原型阶数是4,使用elipbpf函数设计带通,系统函数直接形式和串联形式的系数如下,

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

零极点图

采用elip函数(MATLAB工具箱函数),设计带通,阶数是8阶,系统函数直接形式和串联形式的系数如下

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

给定通带、阻带衰减处的精确频带边界频率,我暂时不会计算,以后学会了再放图吧。

《DSP using MATLAB》Problem 8.46的更多相关文章

  1. 《DSP using MATLAB》Problem 7.13

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

  2. 《DSP using MATLAB》Problem 3.4

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

  3. 《DSP using MATLAB》Problem 8.45

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

  4. 《DSP using MATLAB》Problem 8.44

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

  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. DesktopLoader服务程序

    program DesktopLoader; //{$APPTYPE CONSOLE} uses Windows,WinSvc,ShellApi; var s:String; iDesktops,jD ...

  2. delphi 内存映射

    使用内存映射文件读写大文件 使用内存映射文件读写大文件 文件操作是应用程序最为基本的功能之一,Win32 API和MFC均提供有支持文件处理的函数和类.一般来说,这些函数可以满足大多数场合的要求,但是 ...

  3. 词表征 3:GloVe、fastText、评价词向量、重新训练词向量

    原文地址:https://www.jianshu.com/p/ca2272addeb0 (四)GloVe GloVe本质是加权最小二乘回归模型,引入了共现概率矩阵. 1.基本思想 GloVe模型的目标 ...

  4. 2019牛客多校第三场B-Crazy Binary String(前缀和+思维)

    Crazy Binary String 题目传送门 解题思路 把1记为1,把0记为-1,然后求前缀和,前缀和相等的就说明中间的01数一样.只要记录前缀和数值出现的位置即可更新出答案. 代码如下 #in ...

  5. this和super差异

    <三> this和super差异 1)super(参数):调用基类中的某一个构造函数(应该为构造函数中的第一条语句) 2)this(参数):调用本类中另一种形成的构造函数(应该为构造函数中 ...

  6. Day 21 python :面向对象 类的相关内置函数 /单例模式 /描述符

    1.isinstance(obj,cls) 检查obj是否是类cls的对象: 备注:用isinstance 的时候,产生实例后,会显示实例既是父类的实例,也是子类的实例 class Mom: gend ...

  7. MySQL在win10以及linux下数据库的备份以及还原

    MySQL在win环境或者linux下的命令都是一样的,只是路径不一致而已 MySQL的备份 (非必须)命令行进入MySQL的bin目录 输入命令:mysqldump -u userName -p d ...

  8. 判断页面是否在iframe中,

    //判断页面是否在iframe中,是的话就跳出iframe框,多用于登录页  ,将此段代码放到要做判断的页面上即可 if (window != top) { top.location.href = l ...

  9. C#获取系统服务+进程+启动时间

    原文:C#获取系统服务+进程+启动时间 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/weixin_38208401/article/details ...

  10. js中的Array数组清空

    var data = new Array();//数组 data.length = 0;//数组的长度等于0,数组的项就会被清空