《DSP using MATLAB》Problem 4.15
2024-10-13 06:53:51
只会做前两个,
代码:
%% ----------------------------------------------------------------------------
%% 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)');
运行结果:
最新文章
- linux内核启动以及文件系统的加载过程
- DirectX 文本绘制
- Excel多条件筛选求和
- 判断一个Bitmap图像是否是.9图
- 从注冊流程 分析怎样安全退出多个Activity 多种方式(附DEMO)
- Oracle 学习笔记 11 -- 视图 (VIEW)
- 深入理解REST与Servlet架构的区别
- phper談談最近重構代碼的感受(3)
- 为什么有时候必须添加sys.setdefaultencoding(&#39;utf-8&#39;)
- 一周一个小demo — 前端后台的交互实例
- LeetCode 695. Max Area of Island (岛的最大区域)
- EF+MVC学习中的不理解的问题
- Android开发你不知道的TIPS
- c# 编程语言tag
- 深入分析Zookeeper的实现原理
- CF508E
- Java基础知识总结--反射
- 以ActiveMQ为例JAVA消息中间件学习【2】
- win怎么设置最快捷的下滑关机
- ASP.NET 的ClientIDMode属性
热门文章
- Java 集合-List接口和三个子类实现
- SpringBoot入门篇--整合mybatis+generator自动生成代码+druid连接池+PageHelper分页插件
- English trip -- VC(情景课) 6 A Time
- 20170731xlVba根据数据表和模板表生成新表
- JS-Object (3) JSON; Event Object相关知识(事件冒泡,事件监听, stopPropagation()
- quick pow
- OC MRC之计数器的基本操作(代码分析)
- cas 服务端认证流程
- snapshot相关
- Webbrowser checkbox