%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Exameple 8.29 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %8s \n\n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ % Digital Filter Specifications: Elliptic bandpass
ws = [0.3*pi 0.75*pi]; % digital stopband freq in rad
wp = [0.4*pi 0.6*pi]; % digital passband freq in rad
Rp = 1; % passband ripple in dB
As = 40; % stopband attenuation in dB % Calculation of Elliptic filter parameters:
[N, wn] = ellipord(wp/pi, ws/pi, Rp, As); fprintf('\n ********* Elliptic Filter Order is = %3.0f \n', N) % Digital Elliptic Bandpass Filter Design:
[bhp, ahp] = ellip(N, Rp, As, wn); [C, B, A] = dir2cas(bhp, ahp) % Calculation of Frequency Response:
%[dblp, maglp, phalp, grdlp, wwlp] = freqz_m(blp, alp);
[dbhp, maghp, phahp, grdhp, wwhp] = freqz_m(bhp, ahp); %% -----------------------------------------------------------------
%% Plot
%% ----------------------------------------------------------------- figure('NumberTitle', 'off', 'Name', 'Exameple 8.29')
set(gcf,'Color','white');
M = 1; % Omega max subplot(2,2,1); plot(wwhp/pi, maghp); axis([0, M, 0, 1.2]); grid on;
xlabel(' frequency in \pi units'); ylabel('|H|'); title('Magnitude Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.3, 0.4, 0.6, 0.75, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.8913, 1]); subplot(2,2,2); plot(wwhp/pi, dbhp); axis([0, M, -50, 2]); grid on;
xlabel(' frequency in \pi units'); ylabel('Decibels'); title('Magnitude in dB');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.3, 0.4, 0.6, 0.75, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-50, -40, -1, 0]); subplot(2,2,3); plot(wwhp/pi, phahp/pi); axis([0, M, -1.1, 1.1]); grid on;
xlabel('frequency in \pi nuits'); ylabel('radians in \pi units'); title('Phase Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.3, 0.4, 0.6, 0.75, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-1:0.5:1]); subplot(2,2,4); plot(wwhp/pi, grdhp); axis([0, M, 0, 40]); grid on;
xlabel('frequency in \pi units'); ylabel('Samples'); title('Group Delay');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.3, 0.4, 0.6, 0.75, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0:10:40]);

  运行结果:

注意,设计的滤波器是阶数为10。频率响应如下图,

《DSP using MATLAB》示例Example 8.29的更多相关文章

  1. 《DSP using MATLAB》Problem 8.29

    来汉有一月,往日的高温由于最近几个台风沿海登陆影响,今天终于下雨了,凉爽了几个小时. 接着做题. %% ------------------------------------------------ ...

  2. 《DSP using MATLAB》Problem 7.29

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

  3. DSP using MATLAB 示例Example3.21

    代码: % Discrete-time Signal x1(n) % Ts = 0.0002; n = -25:1:25; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*a ...

  4. DSP using MATLAB 示例 Example3.19

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signa ...

  5. DSP using MATLAB示例Example3.18

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Continuous-time Fou ...

  6. DSP using MATLAB 示例Example3.23

    代码: % Discrete-time Signal x1(n) : Ts = 0.0002 Ts = 0.0002; n = -25:1:25; nTs = n*Ts; x1 = exp(-1000 ...

  7. DSP using MATLAB 示例Example3.22

    代码: % Discrete-time Signal x2(n) Ts = 0.001; n = -5:1:5; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*abs(nT ...

  8. DSP using MATLAB 示例Example3.17

  9. DSP using MATLAB示例Example3.16

    代码: b = [0.0181, 0.0543, 0.0543, 0.0181]; % filter coefficient array b a = [1.0000, -1.7600, 1.1829, ...

  10. DSP using MATLAB 示例 Example3.15

    上代码: subplot(1,1,1); b = 1; a = [1, -0.8]; n = [0:100]; x = cos(0.05*pi*n); y = filter(b,a,x); figur ...

随机推荐

  1. 用svg实现不规则形状

    像这种弧形,用纯html和css很难写,但是用svg就简单多了. 可以用作图工具画出一个弧形,然后导成svg格式.在页面中,下面的白块就是div+svg构成 mixin svgCard(...cont ...

  2. 记录一下我的mac的环境变量的配置参数

    #配置jdk环境export JAVA_7_HOME=/Library/java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Homeexport JAV ...

  3. Git常用命令和Git团队使用规范指南

    转自:https://wsgzao.github.io/post/git/ 前言 在2005年的某一天,Linux之父Linus Torvalds 发布了他的又一个里程碑作品——Git.它的出现改变了 ...

  4. 利用python 模块读取csv文件信息

    还有一个比较简单的方法 # -*- coding=utf-8 -*- import pandas as pddf = pd.read_csv("20170320094630.csv" ...

  5. JSP 调试

    要测试/调试一个JSP或servlet程序总是那么的难.JSP和Servlets程序趋向于牵涉到大量客户端/服务器之间的交互,这很有可能会产生错误,并且很难重现出错的环境. 接下来将会给出一些小技巧和 ...

  6. cocos2d3.0rc编译android工程

    1. 在CMakeLists.txt中配置所有的cpp文件 2. 在proj.android/jni 下的Android.mk中配置所有的cpp文件 3.新建工程 cocos new mygame1 ...

  7. 重新学习MySQL数据库3:Mysql存储引擎与数据存储原理

    重新学习Mysql数据库3:Mysql存储引擎与数据存储原理 数据库的定义 很多开发者在最开始时其实都对数据库有一个比较模糊的认识,觉得数据库就是一堆数据的集合,但是实际却比这复杂的多,数据库领域中有 ...

  8. Linux 踩坑记录

    1. Linux系统上用火狐浏览器看视频的时候发现没有安装flash player插件,无法播放视频.简单几步安装插件,就可以快乐地使用linux系统看视频了. 步骤如下: 一.打开视频网站时提示无法 ...

  9. struts.xml中的配置常量的含义

    struts.serve.static.browserCache 该属性设置浏览器是否缓存静态内容.当应用处于开发阶段时,我们希望每次请求都获得服务器的最新响应,则可设置该属性为false. stru ...

  10. HQL查询中取个别几个字段

    数据表: