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

代码:

%% ------------------------------------------------------------------------
%% 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. Zabbix 历史数据存储到 Elasticsearch

    Zabbix 历史数据存储到 Elasticsearch Zabbix 3.4.6 版本开始支持历史数据存储到 Elasticsearch, 早就想测试这个功能,最近有个需求需保存 zabbix 的历 ...

  2. jenkins在pipline中运行后台命令

    需求 在jenkin中启动java程序或者python程序的时候,希望程序在后台执行,并在jenkins构建完成之后继续执行.在工作中有两个地方我碰到了这种需求 在shell script输入框中pi ...

  3. 树莓派自动播报温湿度到QQ空间、微博

    原文链接 https://aoaoao.me/951.html 这是个比较无聊的应用...灵感来自于一个叫做“古城钟楼”的微博账号,此账号每天都会定点报时,除此之外没有其他任何内容,以此吸引了近50万 ...

  4. MS Sql添加描述信息 及其他信息

    --查询某个表的描述 SELECT * FROM fn_listextendedproperty (NULL, 'user', 'dbo', 'table', '(表名)',NULL, NULL) - ...

  5. Summary 报告

    1.需要在添加一个名为summary report的监听器,跑完之后查看 Label:取样器/监听器名称 Samples :事务数量 Average:平均一个完成一个事务消耗的时间(平均响应时间) M ...

  6. SingalR 构建 推送服务器初探

    项目需要用到推送,于是重新研究了下推送框架,最好能够独立成一个服务,与业务无关的服务,可以给所有的项目通用.找了好久最终决定用SinglR 框架. Signal 是微软支持的一个运行在 Dot NET ...

  7. 磁盘设备在 Linux 下的表示方法

    在 Linux 系统中磁盘设备文件的命名规则为: 主设备号 + 次设备号 + 磁盘分区号 对于目前常见的磁盘,一般表示为: sd[a-z]x 主设备号代表设备的类型,相同的主设备号表示同类型的设备. ...

  8. transport error 202: bind failed: Address already in use

    background: I have terminated some test debugger without properly saying goodbye. the JDWP didn't cl ...

  9. mysql数据库 --表操作

    一.表与表之间建关系 (1) 将所有的数据放在一张表内的弊端 表的组织结构不清晰 浪费存储时间 可扩展性极差 ---> 类似于将所有的代码写入到一个py文件中 -->解耦部分 (2) 如何 ...

  10. vim 中 ctags的应用

    为了方便查询代码段中代码的最终的定义 在linux的vim便以其中可以使用ctags 使用步骤: 1. 安装 ctags :   sudo apt-get install ctags     2. 生 ...