《DSP using MATLAB》示例Example 8.29
- %% ------------------------------------------------------------------------
- %% 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的更多相关文章
- 《DSP using MATLAB》Problem 8.29
来汉有一月,往日的高温由于最近几个台风沿海登陆影响,今天终于下雨了,凉爽了几个小时. 接着做题. %% ------------------------------------------------ ...
- 《DSP using MATLAB》Problem 7.29
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 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 ...
- DSP using MATLAB 示例 Example3.19
代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signa ...
- DSP using MATLAB示例Example3.18
代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Continuous-time Fou ...
- 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 ...
- 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 ...
- DSP using MATLAB 示例Example3.17
- 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, ...
- 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 ...
随机推荐
- css 固定宽度,自动换行
max-width: 200px; display: block; word-break: break-all:
- java网络编程之图片上传
输入输出流核心代码 所有的文件传输都是靠流,其中文件复制最具代表性.输入流和输出流,从输入流中读取数据写入到输出流中. InputStream in = 输入源; OutputStream os = ...
- 重新学习MySQL数据库4:Mysql索引实现原理
重新学习Mysql数据库4:Mysql索引实现原理 MySQL索引类型 (https://www.cnblogs.com/luyucheng/p/6289714.html) 一.简介 MySQL目前主 ...
- 强连通分量算法-codevs1332
解决有向图的强连通分量的算法,有两个,一个是tarjan,一个是kosaraju,上午只看了一下kosaraju,不算太难,理解之后写了个模板题. 先说kosaraju算法,算法的主要思路是进行两次d ...
- SPOJ 694 && SPOJ 705 (不重复子串个数:后缀数组)
题意 给定一个字符串,求它的所有不重复子串的个数 思路 一个字符串的子串都必然是它的某个后缀的前缀.对于每一个sa[i]后缀,它的起始位置sa[i],那么它最多能得到该后缀长度个子串(n-sa[i]个 ...
- os模块、文件压缩 、匹配文件后缀名:fnmatch glob
一.os模块 os模块:是python是系统交互的模块 import os # 0平台信息的一些操作 python是夸平台的,所以内部兼容了不同的平台 1. os.name # 操作系统 nt是win ...
- linux中的redis缓存服务器
Linux中的Redis缓存服务器 一.Redis基础部分: 1.redis介绍与安装比mysql快10倍以上 *****************redis适用场合**************** 1 ...
- iTabs Tab切换插件
最近项目中使用到Tab切换,切换的页面不变,内容发生变化,随手写了份简单的插件,附带源码.先看样子: 本人也考虑到是否使用jquery ui tab,但是还是热衷于自己写一份,首先好处之一是易于培训, ...
- Django中通过定时任务触发页面静态化的方式
安装 pip install django-crontab 添加应用 INSTALLED_APPS = [ ... 'django_crontab', # 定时任务 ... ] 设置任务的定时时间 在 ...
- 动态加载vs静态加载
动态加载: 1:灵活,可以在需要的时候用LoadLibrary进行加载,在不需要的时候用FreeLibrary进行卸载,这样可以不必占用内存. 2:可以在没有dll时候发现,而不致程序报错. 3:加载 ...