zoukankan      html  css  js  c++  java
  • 《DSP using MATLAB》示例Example 7.13

    代码:

    M = 25; alpha = (M-1)/2; n = [0:1:M-1]; 
    
    hd = (2/pi) * ( (sin( (pi/2)*(n-alpha) ).^2)./(n-alpha) ); hd(alpha+1) = 0;
    
    w_han = (hann(M))'; 
    
    h = hd .* w_han;
    [Hr, w, P, L] = Hr_Type3(h);  
    P
    L
    
    %Plot
    
    figure('NumberTitle', 'off', 'Name', 'Exameple 7.13')
    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_han); axis([-1 M 0 1.2]); grid on;
    xlabel('n'); ylabel('w(n)'); title('Hann 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');
    
    w = w'; Hr = Hr';
    w = [-fliplr(w), w(2:501)]; Hr = [-fliplr(Hr), Hr(2:501)];
    subplot(2,2,4); plot(w/pi, Hr); axis([-1 1 -1.1 1.1]); grid on;
    xlabel('frequency in pi units'); ylabel('Hr'); title('Amplitude Response');
    

      运行结果:

        注意:振幅谱的频率范围是-π到π。

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    C# 反射
    WinForm资源管理器开发(TreeView&ListView)
    枚举——完美立方
    关于考证
    人工智能时代,程序员要不要精通算法?
    程序员需要掌握哪些软技能?
    Android数据解析——JSON
    C# 数组转json
    jQuery跨域调用Web API
    oracle 创建表同时添加注释
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/6637855.html
Copyright © 2011-2022 走看看