• 《DSP using MATLAB》Problem 4.15


    只会做前两个,

     

     代码:

    %% ----------------------------------------------------------------------------
    %%            Output Info about this m-file
    fprintf('
    ***********************************************************
    ');
    fprintf('        <DSP using MATLAB> Problem 4.15 
    
    ');
    
    banner();
    %% ----------------------------------------------------------------------------
    
    
    %% ----------------------------------------------------
    %%            1      h(n)=[5(0.25)^n]u(n)
    %%                   x(n)=(0.25^n)u(n)
    %% ----------------------------------------------------
    n = [0:9];
    
    h1 = 5 * (1/4) .^ n .* stepseq(0, 0, 9);
    x  = (1/4) .^ n;
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.15 h1(n) x(n)')
    set(gcf,'Color','white'); 
    subplot(2,1,1); stem(n, h1); 
    xlabel('n'); ylabel('h(n)'); grid on;
    title('h(n)=[5(1/4)^n]u(n)');
    subplot(2,1,2); stem(n, x);
    xlabel('n'); ylabel('x'); grid on;
    title('x(n)=(1/4)^nu(n)');
    
    
    b1 = [5]; a1 = [1, -1/4];                  
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.15 H1(z) pole-zero')
    set(gcf,'Color','white'); 
    zplane(b1, a1);
    title('pole-zero plot'); grid on;
    
    y1 = filter(b1, a1, x);
    
    [y1_chk, ny1_chk] = conv_m(h1, n, x, n);
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.15 y1(n)')
    set(gcf,'Color','white'); 
    subplot(2,1,1); stem([0:length(y1)-1], y1); 
    xlabel('n'); ylabel('h(n)'); grid on;
    title('y(n)=filter(b, a, x)');
    subplot(2,1,2); stem(ny1_chk, y1_chk);
    xlabel('n'); ylabel('y'); grid on;
    title('y(n)=h(n)*x(n)');
    
    
    %% ----------------------------------------------------
    %%            2      h(n)=[n(1/3)^n+(-1/4)^n]u(n)
    %%                   x(n)=(0.25^n)u(n)
    %% ----------------------------------------------------
    n = [0:9];
    
    h2 = (n .* (1/3) .^ n + (-1/4) .^ n ) .* stepseq(0, 0, 9);
    x  = (1/4) .^ n;
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.15 h2(n) x(n)')
    set(gcf,'Color','white'); 
    subplot(2,1,1); stem(n, h2); 
    xlabel('n'); ylabel('h(n)'); grid on;
    title('h(n)=[n(1/3)^n]u(n) + (-1/4)^nu(n)');
    subplot(2,1,2); stem(n, x);
    xlabel('n'); ylabel('x'); grid on;
    title('x(n)=(1/4)^nu(n)');
    
    %b2 = [0, 12, 48, -1]; a2 = [144, -24, -23, 2, 1];                  
    b2 = [1, -1/3, 7/36]; a2 = [1, -5/12, -1/18, 1/36];
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.15 H2(z) pole-zero')
    set(gcf,'Color','white'); 
    zplane(b2, a2);
    title('pole-zero plot'); grid on;
    
    y2 = filter(b2, a2, x);
    
    [y2_chk, ny2_chk] = conv_m(h2, n, x, n);
    
    figure('NumberTitle', 'off', 'Name', 'Problem 4.15 y2(n)')
    set(gcf,'Color','white'); 
    subplot(2,1,1); stem([0:length(y2)-1], y2); axis([0, 9, 0, 1]);
    xlabel('n'); ylabel('h(n)'); grid on;
    title('y(n)=filter(b, a, x)');
    subplot(2,1,2); stem(ny2_chk, y2_chk); axis([0, 9, 0, 1]);
    xlabel('n'); ylabel('y'); grid on;
    title('y(n)=h(n)*x(n)');
    

      运行结果:

     

     

    牢记: 1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
  • 相关阅读:
    select2插件用法
    MVC htmlAttributes and additionalViewData
    Log4Net 配置详解
    Windows10搭建ASP.NET MVC5 IIS局域网(外网可以访问的)服务器
    网络连接状态指示器(NCSI ,Network Connectivity Status Indicator)
    微软官方开发文档结构WPF
    旋转编码器,无限旋转的音量按钮
    Steam Dota2 安装方法以及一些设置·
    Windows资源管理器打开文件夹卡顿原因及解决办法
    字幕变集合制作工具
  • 原文地址:https://www.cnblogs.com/ky027wh-sx/p/8550917.html
Copyright © 2020-2023  润新知