先求模拟信号经过采样后,对应的数字角频率:

明显看出,第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的更多相关文章

  1. 《DSP using MATLAB》Problem 5.19

    代码: function [X1k, X2k] = real2dft(x1, x2, N) %% --------------------------------------------------- ...

  2. 《DSP using MATLAB》Problem 2.19

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  3. 《DSP using MATLAB》Problem 8.19

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  4. 《DSP using MATLAB》Problem 7.16

    使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

  5. 《DSP using MATLAB》Problem 5.18

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% O ...

  6. 《DSP using MATLAB》Problem 5.5

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  7. 《DSP using MATLAB》Problem 5.4

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  8. 《DSP using MATLAB》Problem 5.3

    这段时间爬山去了,山中林密荆棘多,沟谷纵横,体力增强不少. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

  9. 《DSP using MATLAB》Problem 4.23

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

随机推荐

  1. js事件轮询机制

    console.log(1) setTimeout(function(){ console.log(2) },0); console.log(3) 毫无疑问:运行结果是1 3 2 也就是说:setTi ...

  2. Java 常用对象-Date类和Calender类

    2017-11-02 22:29:34 Date类:类 Date 表示特定的瞬间,精确到毫秒. 在 JDK 1.1 之前,类 Date 有两个其他的函数.它允许把日期解释为年.月.日.小时.分钟和秒值 ...

  3. Android ListView常见配置说明

    ListView是我们经常使用的控件,但是使用中却因为各种原因无法设置出我们需要的效果,现将常用的设置记录下来方便以后查询. 1.拖动时背景变黑 android:cacheColorHint=&quo ...

  4. javascript之非构造函数的继承

    这个系列的第一部分介绍了"封装",第二部分介绍了使用构造函数实现"继承". 今天是最后一个部分,介绍不使用构造函数实现"继承". 一.什么是 ...

  5. English trip -- Review Unit7 Shopping 购物

    Xu言: 今天,lamb老师帮我梳理的时候到时提醒了我件事,之前Jade老师也说过每个单元的课程其实有个大主题,我需要把这个单元上完以后全部好好的回顾,然后整理一下.把每个单元的主题以及主题(them ...

  6. Java compiler level does not match the version of the installed Java project facet.解决方法

    右键项目“Properties”,在弹出的“Properties”窗口左侧,单击“Project Facets”,打开“Project Facets”页面. 在页面中的“Java”下拉列表中,选择相应 ...

  7. 『Kaggle』分类任务_决策树&集成模型&DataFrame向量化操作

    决策树这节中涉及到了很多pandas中的新的函数用法等,所以我单拿出来详细的理解一下这些pandas处理过程,进一步理解pandas背后的数据处理的手段原理. 决策树程序 数据载入 pd.read_c ...

  8. python中的注意事项

    .python 中的 and 从左到右计算表达式,若所有值均为真,则返回最后一个值,若存在假,返回第一个假值: or 也是从左到有计算表达式,返回第一个为真的值: 其中数字 0 是假,其他都是真: 字 ...

  9. 基础最短路(模板 bellman_ford)

    Description 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt.但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店 ...

  10. POJ 3481 SBT做法

    第三次做此题.. 不解释啦. 不过变成用SBT来做啦! SBT好处在于能够保证树的高度为lgn,真真正正的平衡二叉树. 因此删除,插入操作与普通二叉树几乎相同. #include <cstdio ...