• 《DSP using MATLAB》示例Example 8.27


    %% ------------------------------------------------------------------------
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Exameple 8.27 
    
    ');
    
    time_stamp = datestr(now, 31);
    [wkd1, wkd2] = weekday(today, 'long');
    fprintf('      Now is %20s, and it is %8s  
    
    ', time_stamp, wkd2);
    %% ------------------------------------------------------------------------
    
    % Digital Highpass Filter Specifications:
    wp = 0.6*pi;                 % digital passband freq in rad
    ws = 0.4586*pi;              % digital stopband freq in rad
    Rp = 1;                      % passband ripple in dB
    As = 15;                     % stopband attenuation in dB
    
    
    [bhp, ahp] = cheb1hpf(wp, ws, Rp, As); [C, B, A] = dir2cas(bhp, ahp)
    
    % Calculation of Frequency Response:
    %[dblp, maglp, phalp, grdlp, wwlp] = freqz_m(blp, alp);
    [dbhp, maghp, phahp, grdhp, wwhp] = freqz_m(bhp, ahp);
    
    
    %% -----------------------------------------------------------------
    %%                             Plot
    %% -----------------------------------------------------------------  
    
    figure('NumberTitle', 'off', 'Name', 'Exameple 8.27')
    set(gcf,'Color','white'); 
    M = 1;                          % Omega max
    
    subplot(2,2,1); plot(wwhp/pi, maghp); axis([0, M, 0, 1.2]); grid on;
    xlabel(' frequency in pi units'); ylabel('|H|'); title('Highpass Filter Magnitude Response');
    set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.4586, 0.6, M]);
    set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.8913, 1]);
    
    subplot(2,2,2); plot(wwhp/pi, dbhp); axis([0, M, -30, 2]); grid on;
    xlabel(' frequency in pi units'); ylabel('Decibels'); title('Highpass Filter Magnitude in dB');
    set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.4586, 0.6, M]);
    set(gca, 'YTickMode', 'manual', 'YTick', [-30, -15, -1, 0]);
    
    subplot(2,2,3); plot(wwhp/pi, phahp/pi); axis([0, M, -1.1, 1.1]); grid on;
    xlabel('frequency in pi nuits'); ylabel('radians in pi units'); title('Highpass Filter Phase Response');
    set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.4586, 0.6, M]);
    set(gca, 'YTickMode', 'manual', 'YTick', [-1:1:1]);
    
    subplot(2,2,4); plot(wwhp/pi, grdhp); axis([0, M, 0, 15]); grid on;
    xlabel('frequency in pi units'); ylabel('Samples'); title('Highpass Filter Group Delay');
    set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.4586, 0.6, M]);
    set(gca, 'YTickMode', 'manual', 'YTick', [0:5:15]);
    

      运行结果:

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    nyoj 599-奋斗的小蜗牛 (double ceil(); (temp
    nyoj 596-谁是最好的Coder (greater, less)
    nyoj 517-最小公倍数 (python range(start, end) range(length))
    用深度学习预测专业棋手走法
    阿里AI设计师一秒出图,小撒连连惊呼,真相是...
    想成为数据科学家?先做到这6点吧!
    Kubernetes 弹性伸缩全场景解析 (一)- 概念延伸与组件布局
    机器学习基础:(Python)训练集测试集分割与交叉验证
    Data Lake Analytics + OSS数据文件格式处理大全
    聊聊Flexbox布局中的flex的演算法
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/6736776.html
Copyright © 2020-2023  润新知