• 《DSP using MATLAB》示例Example7.10


    代码:

    ws1 = 0.2*pi; wp1 = 0.35*pi; wp2 = 0.65*pi; ws2 = 0.8*pi; As = 60; 
    tr_width = min((wp1-ws1), (ws2-wp2));
    M = ceil(11*pi/tr_width) + 1 
    
    n = [0:1:M-1]; wc1 = (ws1+wp1)/2; wc2 = (wp2+ws2)/2;
    
    %wc = (ws + wp)/2,                    % ideal LPF cutoff frequency
    
    hd = ideal_lp(wc2, M) - ideal_lp(wc1, M); 
    w_bla = (blackman(M))';  h = hd .* w_bla;
    [db, mag, pha, grd, w] = freqz_m(h, [1]);  delta_w = 2*pi/1000;
    
    Rp = -(min(db(wp1/delta_w+1:1:wp2/delta_w)))   % Actual Passband Ripple
    
    As = -round(max(db(ws2/delta_w+1:1:501)))   % Min Stopband attenuation
    
    %Plot
    
    figure('NumberTitle', 'off', 'Name', 'Exameple 7.10')
    set(gcf,'Color','white'); 
    
    subplot(2,2,1); stem(n, hd); axis([0 M-1 -0.4 0.5]); grid on;
    xlabel('n'); ylabel('hd(n)'); title('Ideal Impulse Response');
    
    subplot(2,2,2); stem(n, w_bla); axis([0 M-1 0 1.1]); grid on;
    xlabel('n'); ylabel('w(n)'); title('Blackman Window');
    
    subplot(2,2,3); stem(n, h); axis([0 M-1 -0.4 0.5]); grid on;
    xlabel('n'); ylabel('h(n)'); title('Actual Impulse Response');
    
    subplot(2,2,4); plot(w/pi, db); axis([0 1 -150 10]); grid on;
    xlabel('frequency in pi units'); ylabel('Decibels'); title('Magnitude Response in dB');
    

      运行结果:

            Blackman窗函数的长度M=75,实际的阻带衰减As=75dB。

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    角色转变
    参加Google™ Code Jam 中国编程挑战赛(1)
    开始学习研究Infragistics NetAdvantage For ASP.NET
    建立资料库
    参加Google™ Code Jam 中国编程挑战赛(2)
    极度郁闷,上网时间被限定!
    在Win7下Visual Studio如何使用IIS进行调试
    jQuery 第二课:操作包装集元素
    将DataTable导出到Excel
    CSS选择符
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/6625461.html
Copyright © 2020-2023  润新知