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

    代码:

    %% ------------------------------------------------------------------------
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Exameple 9.5 
    
    ');
    
    time_stamp = datestr(now, 31);
    [wkd1, wkd2] = weekday(today, 'long');
    fprintf('      Now is %20s, and it is %7s  
    
    ', time_stamp, wkd2);
    %% ------------------------------------------------------------------------
    
    n = 0:256; x = cos(pi*n); w = [0:100]*pi/100;
    
    %% -----------------------------------------------------------------
    %%                             Plot
    %% -----------------------------------------------------------------  
    Hf1 = figure('units', 'inches', 'position', [1, 1, 8, 6], ...
    	'paperunits', 'inches', 'paperposition', [0, 0, 6, 4], ...
    	'NumberTitle', 'off', 'Name', 'Exameple 9.5');
    set(gcf,'Color','white'); 
    
    TF = 10;
    % (a) Interpolation by I = 2, L = 4 
    I = 2; [y, h] = interp(x, I); H = freqz(h, 1, w); H = abs(H);
    subplot(2, 2, 1); 
    plot(w/pi, H); axis([0, 1, 0, I+0.1]); grid on;
    xlabel('omega in pi units'); ylabel('Magnitude'); 
    title('I = 2, L = 4', 'fontsize', TF);
    set(gca, 'xtick', [0, 0.5, 1]); 
    set(gca, 'ytick', [0:1:I]);
    
    % (b) Interpolation by I = 4, L = 4
    I = 4; [y, h] = interp(x, I); H = freqz(h, 1, w); H = abs(H);
    subplot(2, 2, 2); 
    plot(w/pi, H); axis([0, 1, 0, I+0.2]); grid on;
    xlabel('omega in pi units'); ylabel('Magnitude'); 
    title('I = 4, L = 4', 'fontsize', TF);
    set(gca, 'xtick', [0, 0.25, 1]); 
    set(gca, 'ytick', [0:1:I]);
    
    
    % (c) Interpolation by I = 8, L = 4
    I = 8; [y, h] = interp(x, I); H = freqz(h, 1, w); H = abs(H);
    subplot(2, 2, 3); 
    plot(w/pi, H); axis([0, 1, 0, I+0.4]); grid on;
    xlabel('omega in pi units'); ylabel('Magnitude'); 
    title('I = 8, L = 4', 'fontsize', TF);
    set(gca, 'xtick', [0, 0.125, 1]); 
    set(gca, 'ytick', [0:2:I]);
    
    
    
    % (d) Interpolation by I = 8, L = 10
    I = 8; [y, h] = interp(x, I, 10); H = freqz(h, 1, w); H = abs(H);
    subplot(2, 2, 4); 
    plot(w/pi, H); axis([0, 1, 0, I+0.4]); grid on;
    xlabel('omega in pi units'); ylabel('Magnitude'); 
    title('I = 8, L = 10', 'fontsize', TF);
    set(gca, 'xtick', [0, 0.125, 1]); 
    set(gca, 'ytick', [0:2:I]);
    

      运行结果:

          前三张图L=4,和想象的一样,滤波器是低通性质,其通带边界近似在π/I附近,并且幅度谱最大增益为I。另外注意到滤波器的过渡带和缓,

    因此和理想滤波器相差较大。最后一张,L=10,和想象一样,过渡带比较陡。

    任何超过L=10的情况都会导致滤波器不稳定,因此在设计过程中是必须避免的。

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    tomcat 登录主页成功 点击Manager App 401 等问题
    servlet
    jsp 记录1 bs/cs
    java jar
    Java 第四课 对象 类
    java 第五课 异常
    Java 第三课 数组排序
    java 第二课 标识符
    java 第一课 笔记
    maven 项目问题集锦
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/6901516.html
Copyright © 2011-2022 走看看