《DSP using MATLAB》Problem 4.15
只会做前两个,
代码:
%% ----------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 4.15 \n\n'); 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)');
运行结果:
《DSP using MATLAB》Problem 4.15的更多相关文章
- 《DSP using MATLAB》Problem 7.15
用Kaiser窗方法设计一个台阶状滤波器. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 6.15
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 5.15
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 2.15
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 8.15
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 5.38
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 5.31
第3小题: 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Out ...
- 《DSP using MATLAB》Problem 5.22
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% O ...
- 《DSP using MATLAB》Problem 5.21
证明: 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- 为arm 编译包含gd的php5
1) 下载gd的各种依赖包. 但是不要下载gd本身,因为这是包含在php里的. 探索的时候也下载了 libvpx freetype,可惜最后的编译没过,就没有用上 2)编译各种(编译前记得把各种环境变 ...
- [Java学习] JSON工具学习记录--FastJSON
最近做项目,总是与json打交道,在用了即可json工具后,个人认为fastJson最好用,很方便,API也清晰可见,所以记录下使用方法,给需要的人提供帮助.(部分摘抄自网络) 一.API入口 Fas ...
- python模块——re模块(简单的计算器功能实现_eval版)
#!/usr/bin/env python # -*- coding:utf-8 -*- __author__ = "loki" # Usage: Make a Diy Calcu ...
- 在 Confluence 6 中的 Jira 设置
名字(Name) 输入一个有意义的服务器名字,会让你在 JIRA 服务器中更好的识别你的目录服务器: Jira Service Desk Server My Company Jira 服务器URL(S ...
- Queue CodeForces - 353D (思维dp)
https://codeforces.com/problemset/problem/353/D 大意:给定字符串, 每一秒, 若F在M的右侧, 则交换M与F, 求多少秒后F全在M左侧 $dp[i]$为 ...
- 0001——初涉MySQL
MySQL是一个开源的关系型数据库管理系统. MySQL分为社区版本和企业版 MySQL安装方式: 1.MSI安装(Windows Installer) 2.ZIP安装 选择安装类型: 1.T ...
- PHP:第三章——PHP中的回调函数
<?php header("Content-Type:text/html;charset=utf-8"); //回调函数 //计算两个数只和 function Add($a, ...
- A*算法 寻路
转载 :http://www.cppblog.com/mythit/archive/2009/04/19/80492.aspx A*算法步骤: 1,把起始格添加到开启列表. 2,重复如下的工作: a) ...
- vue兄弟组件传递数据
在main.js里面设置data{eventHub:new Vue() } new Vue({ el: '#app', router, store, template: '<App/>', ...
- 4.18n阶勒让德多项式求解
Q:编写程序,输入正整数n和任意数x,求出勒让德多项式的值Pn(x) #include <iostream> #include<cstdio> using namespace ...