代码:

M = 20; alpha = (M-1)/2; l = 0:M-1; wl = (2*pi/M)*l;
Hrs = [1, 1, 1, zeros(1, 15), 1, 1]; % Ideal Amp Res sampled
Hdr = [1, 1, 0, 0];
wdl = [0, 0.25, 0.25, 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);
a
L %Plot figure('NumberTitle', 'off', 'Name', 'Exameple 7.14')
set(gcf,'Color','white'); subplot(2,2,1); plot(wl(1:11)/pi, Hrs(1:11), 'o', wdl, Hdr); axis([0, 1, -0.1, 1.1]);
xlabel('frequency in \pi nuits'); ylabel('Hr(k)'); title('Frequency Samples: M=20');
grid on; subplot(2,2,2); stem(l, h); axis([-1, M, -0.1, 0.3]);
xlabel('n'); ylabel('h(n)'); title('Impulse Response');
grid on; subplot(2,2,3); plot(ww/pi, Hr, wl(1:11)/pi, Hrs(1:11), 'o'); axis([0, 1, -0.2, 1.2]); grid on;
xlabel('frequency in \pi units'); ylabel('Hr(w)'); title('Amplitude Response');
grid on; subplot(2,2,4); plot(w/pi, db); axis([0, 1, -60, 10]); grid on;
xlabel('frequency in \pi units'); ylabel('Decibels'); title('Magnitude Response');
grid on;

  运行结果:

从图上看出,最小的阻带衰减大概16dB,不符要求(50dB)。如果我们增加M的数值,那么

在过渡带中就会出现采样点,其频率响应我们不能精确知晓。所以在实际情况中,我们很少

采用这种naive设计方法。

《DSP using MATLAB》示例Example7.14的更多相关文章

  1. 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 ...

  2. DSP using MATLAB 示例 Example3.19

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

  3. DSP using MATLAB示例Example3.18

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

  4. 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 ...

  5. 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 ...

  6. DSP using MATLAB 示例Example3.17

  7. 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, ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. 黑客落网记:FBI如何抓捕Anonymous核心成员

    腾讯科技讯 美国新闻网站Daily Dot近日撰文,通过他们掌握的资料和实地采访,还原了Anonymous核心成员被捕的经过. 以下为文章全文: 哈蒙德被捕前夜 2012年3月,一个周六的下午,天气异 ...

  2. C++双向循环链表实现

    双向循环链表C++实现 1.单链表: 结构图: 2.双向链表: 3.双向循环链表: 对于本程序中,则是给定一个_head  头结点,而不是指针,因为这样更加方便避免一些空判断问题 /* 版权信息:狼 ...

  3. 1-24-case流程控制和while循环语句的使用

    大纲: 1.while循环控制语句 while实战---批量添加规则用户 while实战---猜价格游戏 2.case流程控制语句和exit退出 exit实战---返回值测试 case实战---智能解 ...

  4. poj 2739 Sum of Consecutive Prime Numbers 素数 读题 难度:0

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 19697 ...

  5. 【zznu-2093】毁掉这颗二叉树

    题目描述 广寒宫下有株二叉树,树上共有n个节点,通过n-1条树枝连接,树下有一只玉兔,吴刚提着斧子站在一旁. 他恼恨一切同他争夺嫦娥的事物,所以他决定通过砍二叉树上的n-1条树枝来毁掉这颗二叉树. 妙 ...

  6. 十、dbms_shared_pool(提供了对共享池的一些过程和函数访问)

    1.概述 作用:提供了对共享池的一些过程和函数访问,它使用户可以显示共享池中的对象尺寸,绑定对象到共享池,清除绑定到共享池的对象.为了使用该包,必须运行dbmspool.sql脚本来建立该包. 2.包 ...

  7. Jquery validation自定义验证

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. LeetCode OJ:Reorder List(重序链表)

    Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do thi ...

  9. LeetCode OJ:Maximal Square(最大矩形)

    Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and ret ...

  10. week13《java程序设计》第13次作业总结

    week13<java程序设计>第13次作业总结 1. 本周学习总结 以你喜欢的方式(思维导图.OneNote或其他)归纳总结多网络相关内容. 答: 1.IP与端口:ip和域名相对应,可找 ...