《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
证明: 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- C# DataTable按指定列排序
C#提供的内置对象DataTable功能特别的强大,如果我们需要对DataTable中的某一列进行排序怎么处理呢,具体代码如下: DataTable dt = new DataTable(); dt. ...
- 使用mothur进行OTU聚类
微生物16S的OTU聚类工具有很多,最常用的就是 usearch.cdhit-OTU.mothur. 这些工具大多都是针对二代测序平台的,usearch的64bit版本是收费的. 如果要跑PacBio ...
- English trip -- VC(情景课)9 C What are they doing? 他们在做什么?
Grammar focus 语法点: 以What 开头的问句 What is/is/are he/she/they doing? Cutting the grass. Walking the dog. ...
- Android之设计模式
设计模式的概念 1.基本定义:设计模式(Design pattern)是一套被反复使用的代码设计经验的总结.使用设计模式的目的是为了可重用代码.让代码更容易被他人理解.设计模式是是软件工程的基石脉络, ...
- 模拟模拟vij1120
花生采摘 描述 鲁宾逊先生有一只宠物猴,名叫多多.这天,他们两个正沿着乡间小路散步,突然发现路的告示牌上贴着一张小小的纸条:“欢迎免费品尝我种的花生!——熊字”. 鲁宾逊先生和多多都很开心,因为花生正 ...
- _Python定义方法
def 定义一个方法 在项目编程中,我们往往要做很多重复的事,比如一个排序的功能(当然Python中内置排序的方法),在编程中,我们肯定是会多次用到这个功能的,如果我们每次都在要用这个功能时,都去写一 ...
- react中为什么要使用immutable
因为在react中,react的生命周期中的setState()之后的shouldComponentUpdate()阶段默认返回true,所以会造成本组件和子组件的多余的render,重新生成virt ...
- bzoj1607
题解: 帅选法 把相同的放在一起 代码: #include<bits/stdc++.h> using namespace std; ; int n,a[N],s[N],M,ss[N]; i ...
- Redis (一) 概念安装
一.阿里云安装Redis 1.安装Redis yum -y install redis 2.启动Redis service redis start 或者(推荐使用) systemctl start ...
- 驱动程序多线程 PsCreateSystemThread
内核函数PsCreateSystemThread负责创建新线程.该函数可以创建两种线程,一种是用户线程,它属于当前进程中的线程.另一种是系统线程,系统线程不属于当前用户进程,而是属于系统进程,一般PI ...