《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
证明: 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- LeetCode--027--移除元素
问题描述: 给定一个数组 nums 和一个值 val,你需要原地移除所有数值等于 val 的元素,返回移除后数组的新长度. 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间 ...
- DownLoadImage
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA&quo ...
- Many Easy Problem
转自hwk0518,不胜感谢,侵删.
- Trailing Loves (or L'oeufs?) CodeForces - 1114C (数论)
大意: 求n!在b进制下末尾0的个数 等价于求n!中有多少因子b, 素数分解一下, 再对求出所有素数的最小因子数就好了 ll n, b; vector<pli> A, res; void ...
- Jamie and Binary Sequence (changed after round) CodeForces - 916B (贪心)
链接 大意: 求将n划分为k个2的幂的和, 且最大幂最小,字典序尽量大 比较简单的贪心练习题, 但放在div2的B题感觉偏难了..... 先只考虑最大幂最小, 首先注意到直接按n的二进制划分即可得到最 ...
- 『PyTorch』第五弹_深入理解autograd_下:函数扩展&高阶导数
一.封装新的PyTorch函数 继承Function类 forward:输入Variable->中间计算Tensor->输出Variable backward:均使用Variable 线性 ...
- gleez开发环境搭建
一.虚拟主机目录配置 1.配置apache服务器 Apache是常用的web服务器,即常见的用来处理http协议,处理网页的. Apache的配置文件都存放在/etc/apache2/目录,这里有很多 ...
- c++中的const函数
const变量的基础:(这里给出一个小例子) const *p://*p不可以改 int *const p://p不可以改 const int *const p//二者都不可以改 正文: 在C++中, ...
- 常见MIME类型例表
常见MIME类型例表: 序号 内容类型 文件扩展名 描述 1 application/msword doc Microsoft Word 2 application/octet-stream bin ...
- vs2012修改代码编辑区域的背景色