《DSP using MATLAB》Problem 5.7
代码:
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 5.7 \n\n'); banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % --------------------------------------------------
% 1 x(n) = [ 2,4,6,1,3,5 ] N--period
% |
% --------------------------------------------------
x = [2, 4, 6, 1, 3, 5]; N = 6; n = [0 : N-1]; % periodic sequence with period N
y = x( mod(-n, N)+1 ); % circular fold figure('NumberTitle', 'off', 'Name', 'P5.7 x(n) and x(-n)')
set(gcf,'Color','white');
subplot(2,1,1); stem(n, x);
xlabel('n'); ylabel('x(n)');
title('$\tilde x(n) sequence, period N=6$', 'interpreter', 'latex', 'fontsize', 14); grid on;
subplot(2,1,2); stem(n, y);
xlabel('n'); ylabel('y(n)');
title('x(-n) sequence'); grid on; %% ------------------------------------------------------------------
%% DFS(k) of xn sequence, k=[0:N-1], N=6
%% ------------------------------------------------------------------
k1 = [0 : length(x)-1];
%k2 = [-N : N-1];
%k3 = [-N/2 : N/2];
Xk_1 = dfs(x, N); % DFS
magXk = abs( [ Xk_1 ] ); % DFS magnitude
angXk = angle( [Xk_1] )/pi; % DFS angle figure('NumberTitle', 'off', 'Name', 'P5.7 DFS(k) of x(n)')
set(gcf,'Color','white');
subplot(2,1,1); stem(k1, magXk); %axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('magnitude(k)');
title('DFS magnitude of x(n), N=6'); grid on;
subplot(2,1,2); stem(k1, angXk); %axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('angle(k)');
title('DFS angle of x(n), N=6'); grid on; %% ------------------------------------------------------------------
%% DFS(k) of yn sequence, k=[0:N-1], N=6
%% ------------------------------------------------------------------
k1 = [0 : length(y)-1];
%k2 = [-N : N-1];
%k3 = [-N/2 : N/2];
Yk_1 = dfs(y, N); % DFS
magYk = abs( [ Yk_1 ] ); % DFS magnitude
angYk = angle( [Yk_1] )/pi; % DFS angle figure('NumberTitle', 'off', 'Name', 'P5.7 DFS(k) of y(n)')
set(gcf,'Color','white');
subplot(2,1,1); stem(k1, magYk); %axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('magnitude(k)');
title('DFS magnitude of y(n), N=6'); grid on;
subplot(2,1,2); stem(k1, angYk); %axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('angle(k)');
title('DFS angle of y(n), N=6'); grid on;
运行结果:
周期序列及其圆周折叠序列:
原始序列的DFS系数
圆周折叠序列的DFS系数
《DSP using MATLAB》Problem 5.7的更多相关文章
- 《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窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- 设计一个高质量的API接口
参考网址:http://url.cn/5UaTeyv 前言 在设计接口时,有很多因素要考虑,如接口的业务定位,接口的安全性,接口的可扩展性.接口的稳定性.接口的跨域性.接口的协议规则.接口的路径规则. ...
- CSS多div放一行
HTML代码 <body> <div class="right"></div> <div class="left"&g ...
- (C/C++学习笔记) 十九. 模板
十九. 模板 ● 模板的基本概念 模板(template) 函数模板:可以用来创建一个通用功能的函数,以支持多种不同形参,进一步简化重载函数的函数体设计. 语法: template <<模 ...
- VSTO杂项拾零(持续更新中……)
环境:win 7+visual basic 2008 侧重:VSTO 界面:sheetbook工作簿 1.创建一个过程并调用(2017.6.3) Public Class Sheet1 ...
- Java 中的代理模式及动态代理
原文:https://blog.csdn.net/briblue/article/details/73928350
- block,inline-block,行内元素区别及浮动
1.block: 默认占据一行空间,盒子外的元素被迫另起一行 2.inline-block: 行内块盒子,可以设置宽高 3.行内元素: 宽度即使内容宽度,不能设置宽高,如果要设置宽高,需要转换成行内块 ...
- python三目运算符
python 可通过 if 语句来实现三目运算符的功能,因此可以近似地把这种if语句当成三目运算符.作为三目运算符的 if 语句的语法格式如下: True_statements if expressi ...
- bootstrap table 列求和
<div class="modal fade in" id="_modalDialog" tabindex="1" role=&quo ...
- 干货分享!DevExpress v17.1最新版帮助文档下载大全
DevExpress v17.1.5帮助文档下载列表大全来啦!包含.NET.VCL.HTML/JS系列所有帮助文档,提供CHM和PDF两个版本.除已停止更新的Silverlight.Windows 8 ...
- vue2+webpack 开发环境配置
前提条件: 1.安装node.js https://nodejs.org/en/ 下载安装合适的平台 2.安装npm 第一步:初始化项目 新建文件夹 E:\app 推荐vue项目目录结构: confi ...