《DSP using MATLAB》Problem 2.5
2、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.5.2 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %7s \n\n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ n1 = -100; n2 = 100;
n = [n1:n2];
x = exp(0.1* j * pi* n);
%x = cos(0.1 * n); set(gcf,'Color','white');
stem(n,x); title('exp(0.1j\pi n) Sequence');
xlabel('n'); ylabel('x(n)'); grid on; figure
set(gcf,'Color','white');
stem(n,real(x)); title('exp(0.1j\pi n) Real Part Sequence');
xlabel('n'); ylabel('Real[x(n)]'); grid on; figure
set(gcf,'Color','white');
stem(n,imag(x)); title('exp(0.1j\pi n) Imaginary Part Sequence');
xlabel('n'); ylabel('Imag[x(n)]'); grid on; figure
set(gcf,'Color','white');
stem(n,abs(x)); title('exp(0.1j\pi n) Magnitude Sequence');
xlabel('n'); ylabel('|x(n)|'); grid on; figure
set(gcf,'Color','white');
stem(n,(180/pi) * angle(x)); title('exp(0.1j\pi n) Phase Sequence');
xlabel('n'); ylabel('phase[x(n)]'); grid on;
运行结果:
3、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.5.3 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %7s \n\n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ n1 = -20; n2 = 20;
n = [n1:n2];
%x = exp(0.1* j * pi* n);
x = cos(0.1 * n); set(gcf,'Color','white');
stem(n,x); title('cos(0.1n) Sequence');
xlabel('n'); ylabel('x(n)'); grid on;
运行结果:
《DSP using MATLAB》Problem 2.5的更多相关文章
- 《DSP using MATLAB》Problem 7.27
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.26
注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.25
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.24
又到清明时节,…… 注意:带阻滤波器不能用第2类线性相位滤波器实现,我们采用第1类,长度为基数,选M=61 代码: %% +++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.23
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...
- 《DSP using MATLAB》Problem 7.16
使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.15
用Kaiser窗方法设计一个台阶状滤波器. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.14
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.13
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.12
阻带衰减50dB,我们选Hamming窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- king 选 太子
king 选 太子 时间限制:3000 ms | 内存限制:65535 KB 难度:1 描述 啊,从前有一个国家.此国兵强马壮,但是国王却身体不好.于是就想挑一位太子出来: 但是问题来了,国王 ...
- 田忌赛马Java解答
你一定听过田忌赛马的故事吧? 如果3匹马变成1000匹,齐王仍然让他的马按从优到劣的顺序出赛,田忌可以按任意顺序选择他的赛马出赛.赢一局,田忌可以得到200两银子,输一局,田忌就要输掉200两 ...
- python 封装时间常用操作方法-time,datetime
封装脚本: #encoding=utf-8import timefrom datetime import timedelta,date def date_time_chinese(): prin ...
- Linux学习笔记之Linux计划任务Crontab
0x00 cron 简介 cron 是 UNIX, SOLARIS,LINUX 下的一个十分有用的工具.通过 cron 脚本能使计划任务定期地在系统后台自动运行. 0x01 cron 命令 cront ...
- Python3.x:免费代理ip的批量获取并入库
Python3.x:免费代理ip的批量获取并入库 一.简介 网络爬虫的世界,向来都是一场精彩的攻防战.现在许多网站的反爬虫机制在不断的完善,其中最令人头疼的,莫过于直接封锁你的ip.但是道高一尺魔高一 ...
- POJ2533_Longest Ordered Subsequence (线性动态规划变形)
本题求一个字符串中的最长递增子序列的长度. 动态规划方程 a[]记录字符串: d[i]记录以第i个元素为最后一个元素的最长递增序列的长度 则 d[i+1]=1+max(d[j]) 其中(j<i ...
- JS+Canvas的棋盘游戏和Java的动态结合
二维数组的题做了有几个了,感觉很有趣,随后想到想做一个五子棋的游戏. 因为前端知识匮乏,但感觉只是Java中去用二维数组做的话还是不太难的. 首先生成15*15的棋盘,(先不考虑前后端交互),其后Ha ...
- spark内存管理分析
前言 下面的分析基于对spark2.1.0版本的分析,对于1.x的版本可以有区别. 内存配置 key 默认 解释 spark.memory.fraction 0.6 spark可以直接使用的内存大小系 ...
- python实现本地批量ping多个IP
本文主要利用python的相关模块进行批量ping ,测试IP连通性. 下面看具体代码(python3): #!/usr/bin/env python#-*-coding:utf-8-*- impor ...
- BigDecimalUtils BigDecimal加减乘除
public class BigDecimalUtil { private static int DEF_DIV_SCALE = 10; // 默认精确的小数位 /** * 提供精确的加法运算. * ...