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

明显看出,第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. git/ssh备查文档

    配置多个ssh key: 待更新 git速查表: git remote set-url origin(远程仓库名称) https://xxxxx/ProjectName.git  从ssh切换至htt ...

  2. C#代码安装、卸载、监控Windows服务

    C#编写Windows服务之后都不可避免的需要安装,卸载等操作.而传统的方式就是通过DOS界面去编写命令,这样的操作方式无疑会增加软件实施人员的工作量,下面就介绍一种简单.高效.快速方便的方式.1.安 ...

  3. 玲珑杯 ACM热身赛 #2.5 A 记忆化搜索+瞎搞

    #include <cstdio> #include <vector> #include <iostream> #include <algorithm> ...

  4. Java开发常用Util工具类-StringUtil、CastUtil、CollectionUtil、ArrayUtil、PropsUtil

    字符串工具类 StringUtil.java package com.***.util; /** * StringUtil * @description: 字符串工具类 **/ public clas ...

  5. websphere设置企业应用使用的jvm最大最小内存

    websphere设置企业应用使用的jvm最大最小内存 设置jvm 内存的最大最小值.打开was管理控制台  点击应用程序服务器-----server1  点击java和进程管理前面的加号  点击进程 ...

  6. Nastya Is Buying Lunch CodeForces - 1136D (排列)

    大意: 给定n排列, m个pair, 每个pair(u,v), 若u,v相邻, 且u在v左侧, 则可以交换u和v, 求a[n]最多向左移动多少 经过观察可以发现, 尽量先用右侧的人与a[n]交换, 这 ...

  7. python-day15函数递归

    1.递归: 在函数内,调用自己.  (技巧: 每次调用时,函数前面需加上return,这样返回值就可以一层一层 的返回去) #def age(n):#    if n == 1:#        re ...

  8. uva-11426-数论

    https://vjudge.net/problem/UVA-11426#author=0 求 SUM{ gcd(i,j) | 1<=i<j<=n}, n<4000001. 令 ...

  9. EBS OAF开发中的错误/异常处理(ErrorHandling) (转)

    原文地址 EBS OAF开发中的错误/异常处理(ErrorHandling) EBS OAF开发中的错误/异常处理(ErrorHandling) (版权声明,本人原创或者翻译的文章如需转载,如转载用于 ...

  10. quartz---properties

    quartz---properties quartz.properties: 如果没有properties默认读取quartz-2.3.0.jar下的org.quartz下的quartz.proper ...