《DSP using MATLAB》Problem 5.5
代码:
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 5.5 \n\n'); banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % ----------------------------------------------
% 1 x1(n)=5sin(0.1pi*n) n=[0:19], N=40
% ----------------------------------------------
L = 20; n = [0:L-1]; N = 40; %k1 = [0 : N-1]; % wave parameters xn_1 = [5*sin(0.1*pi*n), zeros(1, N-L)]; N3 = 2*length(xn_1);
xn_3 = [xn_1 xn_1]; figure('NumberTitle', 'off', 'Name', 'P5.5 xn_1 and xn_3')
set(gcf,'Color','white');
subplot(2,1,1); stem([0:N-1], xn_1);
xlabel('n'); ylabel('x(n)');
title('xn1 sequence in Problem 5.3, N=40'); grid on;
subplot(2,1,2); stem([0:N3-1], xn_3);
xlabel('n'); ylabel('x(n)');
title('xn3 sequence, N=80'); grid on; %% ------------------------------------------------------
%% DFS(k) of xn1 sequence
%% ------------------------------------------------------
k1 = [0 : length(xn_1)-1];
%k2 = [-N : N-1];
%k3 = [-N/2 : N/2];
Xk_1 = dfs(xn_1, N); % DFS
magXk = abs( [ Xk_1 ] ); % DFS magnitude
angXk = angle( [Xk_1] )/pi; % DFS angle figure('NumberTitle', 'off', 'Name', 'P5.5 DFS(k) of xn_1')
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 xn1, N=40'); 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 xn1, N=40'); grid on; %% ------------------------------------------------------------
%% DFS(k) of xn3 sequence
%% ------------------------------------------------------------
k1 = [0 : N3-1];
%k2 = [-N : N-1];
%k3 = [-N3/2 : N3/2];
Xk_3 = dfs(xn_3, N3);
magXk_3 = abs( [Xk_3]);
angXk_3 = angle( [Xk_3])/pi; figure('NumberTitle', 'off', 'Name', 'P5.5 DFS(k) of xn_3')
set(gcf,'Color','white');
subplot(2,1,1); stem(k1, magXk_3); %axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('magnitude(k)');
title('DFS magnitude of xn3, N=80'); grid on;
subplot(2,1,2); stem(k1, angXk_3); %axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('angle(k)');
title('DFS angle of xn3, N=80'); grid on;
运行结果:
这里假设M=2,即原序列x1重复出现2次得到新序列x3。
《DSP using MATLAB》Problem 5.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窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- outline: none;
outline: none:用在去掉某个选中后显示的外边框,(追求细节) http://www.w3school.com.cn/cssref/pr_outline.asp
- 替代iframe
1.jq中 通过JQuery的load()方法动态加载页面. $( "#result" ).load( "app/test.html" ); 2.vue.rea ...
- Mysql InnoDB三大特性-- 自适应hash index
Mysql InnoDB三大特性-- 自适应hash index
- Oracle Rman 控制RMAN的备份时间,减少IO消耗
一.问题描述 由于服务器配置不高,备份策略为周末全备.周一至周六差异备份. 平时服务器CPU使用30%左右. 全备份时,开启两个通道,CPU达到70%-80%左右,业务不卡顿.不掉单,session不 ...
- ppt点击文字出现图片,再次点击消失
实现效果:在PPT一个页面的任意位置,单击左键,出现图片:在图片上,单击左键,图片消失 实现思路:给图片做两个动画,一个进入,文字作触发器,另一个退出,图片本身为触发器. 实现方法: 1.选中图片…… ...
- mysql 从库执行insert失败导致同步停止
服务配置:一主一从,版本都是 5.5 .主库配置了 binlog-do-db binlog-ignore-db 问题复述:运营人员发现,昨天的数据统计不对.数据分析服务查询的是从库的数据. 到tomc ...
- vue-9-动画
transition: <div id="demo"> <button v-on:click="show = !show"> Toggl ...
- hustoj 管理员和后台设置
之前用过hustoj 的livecd版本,觉得有一些小问题,所以从头到尾搭建.主要包含的过程包括: 安装ubuntu系统 搭建hustoj 管理员和后台资源建设 本文介绍如何在搭建好hustoj的基础 ...
- C++类型转换的注意事项
1.如果两个类型可以相互转换,就说他们是关联的. 2.隐式转换是指,由编译器自行转换,而不需要程序员介入的转换. 3.以下情况,编译器会发生隐式转换: 1)在大多数表达式中,比int类型小的整型值会被 ...
- box-shadow 边框阴影
box-shadow: 0 0 20px #000 inset;