《DSP using MATLAB》Problem 5.37
证明过程:
代码:
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 5.37 \n\n'); banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % -------------------------------------------------------------------------------------
% X(k) is DFTs of real-valued sequence x(n)
% x(n)=A*cos(wn)R(n) n=[0:N-1]
%
% x(n) = sin(5*pi*n/99) n=[0:100-1]
% -------------------------------------------------------------------------------------
N = 100; A = 1;
n1 = [0:N-1];
x1 = A*sin(5*pi*n1/99); figure('NumberTitle', 'off', 'Name', 'P5.37 x(n), N=100')
set(gcf,'Color','white');
stem(n1, x1);
xlabel('n'); ylabel('x(n)');
title('x(n)=sin(5\pin/99)'); grid on; k1 = [0:N-1];
Xk_DFT = fft(x1, N);
N1 = length(Xk_DFT); % length magXk_DFT = abs( [ Xk_DFT ] ); % DFT magnitude
angXk_DFT = angle( [Xk_DFT] )/pi; % DFT angle
realXk_DFT = real(Xk_DFT); imagXk_DFT = imag(Xk_DFT); figure('NumberTitle', 'off', 'Name', 'P5.37 X(k), DFT of x(n) N=100')
set(gcf,'Color','white');
subplot(2,1,1); stem(k1, magXk_DFT);
xlabel('k'); ylabel('magnitude(k)');
title('magnitude DFT of x(n)'); grid on;
subplot(2,1,2); stem(k1, angXk_DFT);
%axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('angle(k)');
title('angle DFT of x(n)'); grid on; figure('NumberTitle', 'off', 'Name', 'P5.37 X(k), N=100')
set(gcf,'Color','white');
subplot(2,1,1); stem(k1, realXk_DFT);
xlabel('k'); ylabel('real (k)');
title('real DFT of x(n)'); grid on;
subplot(2,1,2); stem(k1, imagXk_DFT);
%axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('imag (k)');
title('imag DFT of x(n)'); grid on;
运行结果:
原始序列
不同范围的DFT
《DSP using MATLAB》Problem 5.37的更多相关文章
- 《DSP using MATLAB》Problem 8.37
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 7.37
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 8.32
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 7.36
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《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 ...
随机推荐
- Win10系列:C#应用控件基础2
HyperlinkButton控件 HyperlinkButton控件是以超链接文本形式显示的按钮,可以为其NavigateUri属性设置一个URI地址,当单击超链接文本按钮时,将会使用浏览器打开在H ...
- 【oracle】一些的常用命令
命令行连接oracle sqlplus 回车 分别输入用户名和密码 命令行重启oracle数据库 sqlplus /nolog conn 账号/密码 as sysdba shutdow immedi ...
- owin启动事项
在上下文中找不到 owin.Environment 项 owin没有启动. 尝试加载应用时出现了以下错误.- 找不到包含 OwinStartupAttribute 的程序集 startup类不是通过v ...
- [Leetcode 101]判断对称树 Symmetric Tree
[题目] Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). ...
- doctype和Quirks模式
doctype: 告诉浏览器使用什么模式去渲染页面,可能会影响页面的css渲染和js代码的执行. DTD :为了兼容旧的浏览器渲染方式,将DTD作为参数告诉浏览器使用什么模式渲染页面.始于IE6; 1 ...
- SQL-37 创建索引
题目描述 针对如下表actor结构创建索引:CREATE TABLE IF NOT EXISTS actor (actor_id smallint(5) NOT NULL PRIMARY KEY,fi ...
- SQL-4查找所有已经分配部门的员工的last_name和first_name(自然连接)
题目描述 查找所有已经分配部门的员工的last_name和first_nameCREATE TABLE `dept_emp` (`emp_no` int(11) NOT NULL,`dept_no` ...
- netty的decoder encoder
public class DelimiterBasedFrameDecoder extends ByteToMessageDecoder { 随便找了一个用字符串分割粘包的decoder,继承了Byt ...
- 了解下webpack的几个命令
[ webpack3.0.0刚刚出来 所以文章是跟着低版本 教程 操作熟悉 结果好多对不上喔] 六:了解下webpack的几个命令 webpack // 最基本的启动webpack ...
- get 和post 请求的写法
get请求 import requests base_url = 'http://httpbin.org' # 定义请求所需的参数,参数之间以英文逗号隔开 param_data = {'} # 发送G ...