《DSP using MATLAB》 Problem 3.19
先求模拟信号经过采样后,对应的数字角频率:
明显看出,第3种采样出现假频了。DTFT是以2π为周期的,所以假频出现在10π-2kπ=0处。
代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 3.19 \n\n'); banner();
%% ------------------------------------------------------------------------ %% -------------------------------------------------------------------
%% xa(t)=sin(1000pit)
%% -------------------------------------------------------------------
Ts = 0.0001; % second unit
n1 = [-100:100]; x1 = sin(1000*pi*n1*Ts); figure('NumberTitle', 'off', 'Name', sprintf('Problem 3.19 Ts = %.4f', Ts));
set(gcf,'Color','white');
%subplot(2,1,1);
stem(n1, x1);
xlabel('n'); ylabel('x');
title(sprintf('x1(n) input sequence, Ts = %.4f', Ts)); grid on; M = 500;
[X1, w] = dtft1(x1, n1, M); magX1 = abs(X1); angX1 = angle(X1); realX1 = real(X1); imagX1 = imag(X1); %% --------------------------------------------------------------------
%% START X(w)'s mag ang real imag
%% --------------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'Problem 3.19 X1');
set(gcf,'Color','white');
subplot(2,1,1); plot(w/pi,magX1); grid on; %axis([-1,1,0,1.05]);
title('Magnitude Response');
xlabel('frequency in \pi units'); ylabel('Magnitude |H|');
subplot(2,1,2); plot(w/pi, angX1/pi); grid on; %axis([-1,1,-1.05,1.05]);
title('Phase Response');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); figure('NumberTitle', 'off', 'Name', 'Problem 3.19 X1');
set(gcf,'Color','white');
subplot(2,1,1); plot(w/pi, realX1); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot(2,1,2); plot(w/pi, imagX1); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary');
%% -------------------------------------------------------------------
%% END X's mag ang real imag
%% ------------------------------------------------------------------- % ----------------------------------------------------------
% Ts=0.001s
% ----------------------------------------------------------
Ts = 0.001; % second unit
n2 = [-100:100]; x2 = sin(1000*pi*n2*Ts); figure('NumberTitle', 'off', 'Name', sprintf('Problem 3.19 Ts = %.4f', Ts));
set(gcf,'Color','white');
%subplot(2,1,1);
stem(n2, x2);
xlabel('n'); ylabel('x');
title(sprintf('x2(n) input sequence, Ts = %.4f', Ts)); grid on; M = 500;
[X2, w] = dtft1(x2, n2, M); magX2 = abs(X2); angX2 = angle(X2); realX2 = real(X2); imagX2 = imag(X2); %% --------------------------------------------------------------------
%% START X(w)'s mag ang real imag
%% --------------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'Problem 3.19 X2');
set(gcf,'Color','white');
subplot(2,1,1); plot(w/pi,magX2); grid on; %axis([-1,1,0,1.05]);
title('Magnitude Response');
xlabel('frequency in \pi units'); ylabel('Magnitude |H|');
subplot(2,1,2); plot(w/pi, angX2/pi); grid on; %axis([-1,1,-1.05,1.05]);
title('Phase Response');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); figure('NumberTitle', 'off', 'Name', 'Problem 3.19 X2');
set(gcf,'Color','white');
subplot(2,1,1); plot(w/pi, realX2); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot(2,1,2); plot(w/pi, imagX2); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary');
%% -------------------------------------------------------------------
%% END X's mag ang real imag
%% ------------------------------------------------------------------- % ----------------------------------------------------------
% Ts=0.01s
% ----------------------------------------------------------
Ts = 0.01; % second unit
n3 = [-100:100]; x3 = sin(1000*pi*n3*Ts); figure('NumberTitle', 'off', 'Name', sprintf('Problem 3.19 Ts = %.4f', Ts));
set(gcf,'Color','white');
%subplot(2,1,1);
stem(n3, x3);
xlabel('n'); ylabel('x');
title(sprintf('x3(n) input sequence, Ts = %.4f', Ts)); grid on; M = 500;
[X3, w] = dtft1(x3, n3, M); magX3 = abs(X3); angX3 = angle(X3); realX3 = real(X3); imagX3 = imag(X3); %% --------------------------------------------------------------------
%% START X(w)'s mag ang real imag
%% --------------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'Problem 3.19 X3');
set(gcf,'Color','white');
subplot(2,1,1); plot(w/pi,magX3); grid on; %axis([-1,1,0,1.05]);
title('Magnitude Response');
xlabel('frequency in \pi units'); ylabel('Magnitude |H|');
subplot(2,1,2); plot(w/pi, angX3/pi); grid on; %axis([-1,1,-1.05,1.05]);
title('Phase Response');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); figure('NumberTitle', 'off', 'Name', 'Problem 3.19 X3');
set(gcf,'Color','white');
subplot(2,1,1); plot(w/pi, realX3); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot(2,1,2); plot(w/pi, imagX3); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary');
%% -------------------------------------------------------------------
%% END X's mag ang real imag
%% -------------------------------------------------------------------
运行结果:
采样后的序列及其谱。
《DSP using MATLAB》 Problem 3.19的更多相关文章
- 《DSP using MATLAB》Problem 5.19
代码: function [X1k, X2k] = real2dft(x1, x2, N) %% --------------------------------------------------- ...
- 《DSP using MATLAB》Problem 2.19
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 8.19
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 7.16
使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 5.18
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% O ...
- 《DSP using MATLAB》Problem 5.5
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 5.4
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 5.3
这段时间爬山去了,山中林密荆棘多,沟谷纵横,体力增强不少. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 4.23
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
随机推荐
- 一个纯净的webpack4+angular5脚手架
该篇主要是结合刚发布不久的webpack4,搭建一个非cli的angular5的脚手架demo,主要分为以下几个方面阐述下脚手架结构: # 脚手架基础架构(根据angular5的新规范) /** * ...
- Python 爬虫-正则表达式
2017-07-27 13:52:08 一.正则表达式的概念 (1)正则表达式是用来简洁表达一组字符串的表达式,最主要应用在字符串匹配中. 正则表达式是用来简洁表达一组字符串的表达式 正则表达式是一 ...
- Confluence 6 为站点禁用匿名用户访问
希望为你的站点禁用匿名用户的访问,取消选择 可以使用(can use)前面的选择框,然后选择 保存所有(Save All).这时候,用户应该禁止访问你的站点直达这些用户登录你的 Confluence ...
- 当保存在Session中的对象,取出后,在外部发生改变时会怎样
return_reason_model model = new return_reason_model(); model.F_RetunrnReason = "; HttpContext.S ...
- Codeforces Round #449 (Div. 1)C - Willem, Chtholly and Seniorious
ODT(主要特征就是推平一段区间) 其实就是用set来维护三元组,因为数据随机所以可以证明复杂度不超过O(NlogN),其他的都是暴力维护 主要操作是split,把区间分成两个,用lowerbound ...
- Java网络编程和NIO详解8:浅析mmap和Direct Buffer
Java网络编程与NIO详解8:浅析mmap和Direct Buffer 本系列文章首发于我的个人博客:https://h2pl.github.io/ 欢迎阅览我的CSDN专栏:Java网络编程和NI ...
- ubuntu安装环境软件全文档
1,安装apace2: sudo apt-get install apache2 2谷歌浏览器的安装:sudo apt-get install chromium-browser-dbg 3,国际版Q ...
- zzuli303(奇葩26进制转换)
序号互换 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 Dr.Kong设计了一个聪明的机器人卡多,卡多会对电子表格中的单元格坐标快速计算出来.单元格的行坐标是由数字 ...
- 使用CLOB抛出数字或值错误异常
今天在调试某个问题的时候,由于使用了很多循环,我需要都打印出来,试图使用clob整体处理之后再打印. 最后抛出此异常:数字或值错误. 网友解释如下: $ oerr ora 650206502, 000 ...
- Oracle外部表的管理和应用
外部表作为oracle的一种表类型,虽然不能像普通库表那么应用方便,但有时在数据迁移或数据加载时,也会带来极大的方便,有时比用sql*loader加载数据来的更为方便,下面就将建立和应用外部表的命令和 ...