《DSP using MATLAB》示例Example7.17

代码:
M = 40; alpha = (M-1)/2; l = 0:M-1; wl = (2*pi/M)*l;
T1 = 0.109021; T2 = 0.59417456;
Hrs = [zeros(1, 5),T1,T2, ones(1, 7),T2,T1, zeros(1, 9),T1,T2, ones(1,7), T2,T1,zeros(1,4)]; % Ideal Amp Res sampled
Hdr = [0, 0, 1, 1, 0, 0]; wdl = [0, 0.2, 0.35, 0.65, 0.8, 1]; % Ideal Amp Res for plotting
k1 = 0:floor((M-1)/2); k2 = floor((M-1)/2)+1:M-1; angH = [-alpha*(2*pi)/M*k1, alpha*(2*pi)/M*(M-k2)];
H = Hrs.*exp(j*angH); h = real(ifft(H, M)); [db, mag, pha, grd, w] = freqz_m(h, 1);
[Hr, ww, a, L] = Hr_Type2(h); %Plot figure('NumberTitle', 'off', 'Name', 'Exameple 7.17a')
set(gcf,'Color','white'); subplot(2,2,1); plot(wl(1:21)/pi, Hrs(1:21), 'o', wdl, Hdr); axis([0, 1, -0.1, 1.1]);
xlabel('frequency in \pi nuits'); ylabel('Hr(k)'); title('Bandpass: M=40, T1=0.5941, T2=0.109');
grid on; subplot(2,2,2); stem(l, h); axis([-1, M, -0.4, 0.4]); grid on;
xlabel('n'); ylabel('h(n)'); title('Impulse Response'); subplot(2,2,3); plot(ww/pi, Hr, wl(1:21)/pi, Hrs(1:21), 'o'); axis([0, 1, -0.2, 1.2]); grid on;
xlabel('frequency in \pi units'); ylabel('Hr(w)'); title('Amplitude Response'); subplot(2,2,4); plot(w/pi, db); axis([0, 1, -100, 10]); grid on;
xlabel('frequency in \pi units'); ylabel('Decibels'); title('Magnitude Response');
运行结果:

从幅度谱上看出,最小阻带衰减As大概60dB,满足设计要求。
《DSP using MATLAB》示例Example7.17的更多相关文章
- DSP using MATLAB 示例Example3.17
- 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.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 ...
- DSP using MATLAB 示例 Example3.13
上代码: w = [0:1:500]*pi/500; % freqency between 0 and +pi, [0,pi] axis divided into 501 points. H = ex ...
随机推荐
- python中多重继承与获取对象
1.python中多重继承 除了从一个父类继承外,Python允许从多个父类继承,称为多重继承. 多重继承的继承链就不是一棵树了,它像这样: class A(object): def __init__ ...
- Saltstack 命令行:批量覆盖指定文件
master指定文件,覆盖到所有minion命令 salt-cp '*' /etc/hosts /etc/ -------------------------------------------- { ...
- kali 2016:mount ntfs 分区只读 --Falling back to read-only mount because the NTFS partition is in an unsafe state.
mount ntfs 分区 mount /dev/sdb1 /mnt/d 提示: The disk contains an unclean file system (0, 0).Metadata ke ...
- LeetCode第[10]题(Java):Regular Expression Matching
题目:匹配正则表达式 题目难度:hard 题目内容:Implement regular expression matching with support for '.' and '*'. '.' Ma ...
- 使用Entity Framework时遇到的各种问题总结
在这里记录一下之前使用Entity Framework(4.3.1版本)遇到的问题. 更新没有设置主键的表 在默认情况下,EF不能对一个没有主键的表进行更新.插入和删除的动作.用xml方式查看edmx ...
- python time 和 datetime 模块的简介
时间处理 time 和 datetime import timeimport datetimeprint time.time() #时间戳显示为1508228106.49print time.strf ...
- Hadoop2.9下运行JAR包时System.out.println的输出日志
根据博文——Hadoop日志存放路径详解中所述,Container日志包含ApplicationMaster日志和普通Task日志(关于其他类型的日志的详细说明请参考该博文,本文不再赘述) 所以可知, ...
- Ceph:pg peering过程分析
转自:https://www.ustack.com/blog/ceph%ef%bc%8dpg-peering/ Peering:互为副本的三个(此处为设置的副本个数,通常设置为3)pg的元数据达到一致 ...
- 28-THREE.JS 扇形圆形
<!DOCTYPE html> <html> <head> <title></title> <script src="htt ...
- flask_sqlalchemy + sqlite 的一系列使用方法
如何使用在官网上有详细记录 :http://flask-sqlalchemy.pocoo.org/2.3/ 作为项目笔记,简单阐述使用方法: 1.创建flask_sqlalchemy基于sqlite的 ...