代码:

M = 21; alpha = (M-1)/2; n = [0:1:M-1]; 

hd = (cos(pi*(n-alpha)))./(n-alpha); hd(alpha+1) = 0;

w_ham = (hamming(M))'; 

h = hd .* w_ham;
[Hr, w, c, L] = Hr_Type3(h); %Plot figure('NumberTitle', 'off', 'Name', 'Exameple 7.12')
set(gcf,'Color','white'); subplot(2,2,1); stem(n, hd); axis([-1 M -1.2 1.2]); grid on;
xlabel('n'); ylabel('hd(n)'); title('Ideal Impulse Response'); subplot(2,2,2); stem(n, w_ham); axis([-1 M 0 1.2]); grid on;
xlabel('n'); ylabel('w(n)'); title('Hamming Window'); subplot(2,2,3); stem(n, h); axis([-1 M -1.2 1.2]); grid on;
xlabel('n'); ylabel('h(n)'); title('Actual Impulse Response'); subplot(2,2,4); plot(w/pi, Hr/pi); axis([0 1 0 1]); grid on;
xlabel('frequency in pi units'); ylabel('slope in pi units'); title('Amplitude Response');

  运行结果:

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

  1. DSP using MATLAB 示例 Example3.12

    用到的性质 代码: n = -5:10; x = sin(pi*n/2); k = -100:100; w = (pi/100)*k; % freqency between -pi and +pi , ...

  2. DSP using MATLAB 示例Example2.12

    代码: b = [1]; a = [1, -0.9]; n = [-5:50]; h = impz(b,a,n); set(gcf,'Color','white'); %subplot(2,1,1); ...

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

    用到的性质 上代码: n = -5:10; x = rand(1,length(n)); k = -100:100; w = (pi/100)*k; % freqency between -pi an ...

  7. DSP using MATLAB 示例 Example3.10

    用到的性质 上代码: n = -5:10; x = rand(1,length(n)) + j * rand(1,length(n)); k = -100:100; w = (pi/100)*k; % ...

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

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

随机推荐

  1. 关于http请求ContentType:application/x-www-form-urlencoded

    在又一次http请求过程中,模拟post请求提交form表单数据一直提示部分参数为空,后面检查发现是缺少ContentType:application/x-www-form-urlencoded的原因 ...

  2. python的os.urandom 的用途

    Python中os.urandom(n)的作用 随机产生n个字节(0-255)的字符串,可以作为随机加密key使用~ >>> index = os.urandom(2) >&g ...

  3. MySQL设置某一字段默认为0,但是插入数据化却显示为null

    1.MySQL字段默认的含义:在插入时不指定该字段的值:2.以mybatis举例,如果是插入实体,那么为空的字段就会插入空:3.如果不想mybatis等持久化工具插入空,可以尝试insertSelec ...

  4. Codeforces Round #428 (Div. 2)E. Mother of Dragons

    http://codeforces.com/contest/839/problem/E 最大团裸题= =,用Bron–Kerbosch算法,复杂度大多博客上没有,维基上查了查大约是O(3n/3) 最大 ...

  5. LeetCode 525. Contiguous Array

    525. Contiguous Array Add to List Description Submission Solutions Total Accepted: 2476 Total Submis ...

  6. net.paoding.analysis.exception.PaodingAnalysisException: dic home should not be a file, but a directory!

    Caused by: net.paoding.analysis.exception.PaodingAnalysisException: dic home should not be a file, b ...

  7. 【Raspberry Pi】USB无线网卡自动连接

    Raspberry Pi 使用USB无线网卡的时候不会因为路由重启而掉线. #!/bin/bash while true ; do if ifconfig wlan0 | grep -q " ...

  8. Django开发BUG "Model class WH_auth.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS."

    当进行数据库迁移的时候发生问题,报错如下:RuntimeError: Model class WH_auth.models.User doesn't declare an explicit app_l ...

  9. section和div

    section和div 一.DIV div即division(区块),把文档分割为独立的.不同的部份.作用,以下三种情况应该用div标签: 1.用于页面布局,且不是 header.footer 之类的 ...

  10. 【51nod-1432】独木舟

    排序后用二分,一直卡在最后一组数据,最后改成long long才AC... #include <bits/stdc++.h> using namespace std; typedef lo ...