《DSP using MATLAB》Problem 2.15
代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.15 \n\n'); banner();
%% ------------------------------------------------------------------------ nx1 = [-3:3]; x1 = [2, -4, 5, 3, -1, -2, 6];
nh1 = [-1:3]; h1 = [1, -1, 1, -1, 1]; nx2 = [-2:2]; x2 = [1, 1, 0, 1, 1];
nh2 = [-3:0]; h2 = [1, -2, -3, 4]; nx3 = [-2:6]; x3 = (0.25 .^ (-nx3)) .* (stepseq(-1, -2, 6) - stepseq(4, -2, 6));
nh3 = [-2:6]; h3 = stepseq(0, -2, 6) - stepseq(5, -2, 6); nx4 = [-3:7]; x4 = (nx4/4) .* (stepseq(0, -3, 7) - stepseq(6, -3, 7)) ;
nh4 = [-3:7]; h4 = 2 * (stepseq(-2, -3, 7) - stepseq(3, -3, 7)); [y1, ny1] = conv_m(x1, nx1, h1, nh1);
[y2, ny2] = conv_m(x2, nx2, h2, nh2);
[y3, ny3] = conv_m(x3, nx3, h3, nh3);
[y4, ny4] = conv_m(x4, nx4, h4, nh4); figure('NumberTitle', 'off', 'Name', 'Problem 2.15')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(3,1,1); stem(nx1, x1); title('x1 sequence');
xlabel('n'); ylabel('x(n)') ;
grid on
subplot(3,1,2); stem(nh1, h1); title('h1 sequence');
xlabel('n'); ylabel('h1(n)');
grid on;
subplot(3,1,3); stem(ny1, y1); title('y1=x1*h1 sequence');
xlabel('n'); ylabel('y1(n)');
grid on; figure('NumberTitle', 'off', 'Name', 'Problem 2.15')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(3,1,1); stem(nx2, x2); title('x2 sequence');
xlabel('n'); ylabel('x2(n)') ;
grid on
subplot(3,1,2); stem(nh2, h2); title('h2 sequence');
xlabel('n'); ylabel('h2(n)');
grid on;
subplot(3,1,3); stem(ny2, y2); title('y2=x2*h2 sequence');
xlabel('n'); ylabel('y2(n)');
grid on; figure('NumberTitle', 'off', 'Name', 'Problem 2.15')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(3,1,1); stem(nx3, x3); title('x3 sequence');
xlabel('n'); ylabel('x3(n)') ;
grid on
subplot(3,1,2); stem(nh3, h3); title('h3 sequence');
xlabel('n'); ylabel('h3(n)');
grid on;
subplot(3,1,3); stem(ny3, y3); title('y3=x3*h3 sequence');
xlabel('n'); ylabel('y3(n)');
grid on; figure('NumberTitle', 'off', 'Name', 'Problem 2.15')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(3,1,1); stem(nx4, x4); title('x4 sequence');
xlabel('n'); ylabel('x4(n)') ;
grid on
subplot(3,1,2); stem(nh4, h4); title('h4 sequence');
xlabel('n'); ylabel('h4(n)');
grid on;
subplot(3,1,3); stem(ny4, y4); title('y4=x4*h4 sequence');
xlabel('n'); ylabel('y4(n)');
grid on;
运行结果:
《DSP using MATLAB》Problem 2.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 4.15
只会做前两个, 代码: %% ---------------------------------------------------------------------------- %% Outpu ...
- 《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
证明: 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- E题:Water Problem(快速幂模板)
题目大意:原题链接 题解链接 解题思路:令x=x-1代入原等式得到新的等式,两式相加,将sin()部分抵消掉,得到只含有f(x)的状态转移方程f(x+1)=f(x)+f(x-2)+f(x-3),然后 ...
- 2018年浙江中医药大学程序设计竞赛 Solution
Problem A. Jhadgre的C语言程序 签. #include <bits/stdc++.h> using namespace std; int main() { puts(&q ...
- hdu 5068 线段树加+dp
这题说的是 有n 层每层 有两个门 每个门 可以到达上一层的两个门,然后求从a 层到达b 层的方案总数, 不能后退, 在同一层中不能从第一个门到达另一层 我们只要我们可以对于每个 区间内 有dp[o] ...
- python socket编程 实现简单p2p聊天程序
目标是写一个python的p2p聊天的项目,这里先说一下python socket的基础课程 一.Python Socket 基础课程 Socket就是套接字,作为BSD UNIX的进程通信机制,取后 ...
- facebook graph api 报错SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)')
使用facebook graph api,报错如下 一开始以为是https证书验证失败,查了一下午源码,没有看到问题,于是把Python27\lib\site-packages\requests\ad ...
- JDBC 连接Oracle 数据库,JDBC 连接Mysql 数据库
首先是JDBC 连接Oracle 数据库 package com.util; import com.pojo.UserInfo; import java.sql.*; public class DB ...
- PowerDesigner教程系列
文章转载至:http://www.cnblogs.com/yxonline/archive/2007/04/09/705479.html PowerDesigner教程系列(一)概念数据模型 目标:本 ...
- bzoj3629 / P4397 [JLOI2014]聪明的燕姿
P4397 [JLOI2014]聪明的燕姿 根据唯一分解定理 $n=q_{1}^{p_{1}}*q_{2}^{p_{2}}*q_{3}^{p_{3}}*......*q_{m}^{p_{m}}$ 而$ ...
- 【bzoj2721】[Violet 5]樱花
题目传送门:https://www.lydsy.com/JudgeOnline/problem.php?id=2721 好久没做数学题了,感觉有些思想僵化,走火入魔了. 这道题就是求方程$ \frac ...
- xtu 1242 Yada Number 容斥原理
Yada Number Problem Description: Every positive integer can be expressed by multiplication of prime ...