zoukankan      html  css  js  c++  java
  • 《DSP using MATLAB》示例Example7.9

    代码:

    wp = 0.2*pi; ws = 0.3*pi; As = 50; tr_width = ws - wp;
    M = ceil((As-7.95)/(2.285*tr_width) + 1 ) + 1
    
    n = [0:1:M-1]; beta = 0.1102*(As-8.7)
    wc = (ws + wp)/2;                    % ideal LPF cutoff frequency
    hd = ideal_lp(wc, M); 
    w_kai = (kaiser(M, beta))';  h = hd .* w_kai;
    [db, mag, pha, grd, w] = freqz_m(h, [1]);  delta_w = 2*pi/1000;
    
    % Rp = -(min(db(1:1:wp/delta_w+1)));   % Actual Passband Ripple
    
    As = -round(max(db(ws/delta_w+1:1:501)))   % Min Stopband attenuation
    
    %Plot
    
    figure('NumberTitle', 'off', 'Name', 'Exameple 7.9')
    set(gcf,'Color','white'); 
    
    subplot(2,2,1); stem(n, hd); axis([0 M-1 -0.1 0.3]); grid on;
    xlabel('n'); ylabel('hd(n)'); title('Ideal Impulse Response');
    
    subplot(2,2,2); stem(n, w_kai); axis([0 M-1 0 1.1]); grid on;
    xlabel('n'); ylabel('w(n)'); title('Kaiser Window');
    
    subplot(2,2,3); stem(n, h); axis([0 M-1 -0.1 0.3]); grid on;
    xlabel('n'); ylabel('h(n)'); title('Actual Impulse 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 in dB');
    

      运行结果:

            我们注意到,Kaiser窗函数的特征,长度M=61,β =4.5513,滤波器Rp=0.0442dB,阻带衰减As=52dB,满足设计要求。

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    httphelper
    MD5加密
    json操作
    将list转成tree
    GenerateId类:生成唯一id、订单号
    加密、解密(默认密钥向量)
    Hadoop HDFS批量处理
    OceanBase学习总结
    TiDB学习
    开机自启动rc.local文件修改权限
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/6625441.html
Copyright © 2011-2022 走看看