频率采样定理是这样的:

由上述定理可知,一个有限长序列(假设为N)的DTFT等间隔采样,采样数至少大于等于N。

代码:

%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 5.6 \n\n'); banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % --------------------------------------------------
% 1 x(n) = n + 1 n=[ 0:49]
% = 100-n n=[50:99]
% = 0 otherwise
% --------------------------------------------------
L = 50; n = [0:L-1]; N = 100; %k1 = [0 : N-1]; % wave parameters xn_1 = [n+1, 100-(n+50)]; % length 100
xn_2 = [xn_1, zeros(1,100)]; % padding 100 zeros figure('NumberTitle', 'off', 'Name', 'P5.6 xn_1 and xn_2')
set(gcf,'Color','white');
subplot(2,1,1); stem([0:N-1], xn_1);
xlabel('n'); ylabel('x(n)');
title('xn1 sequence'); grid on;
subplot(2,1,2); stem([0:length(xn_2)-1], xn_2);
xlabel('n'); ylabel('x(n)');
title('xn2 sequence'); grid on; % -------------------------------------------------------------
% X(jw), DTFT of x(n)
% -------------------------------------------------------------
MM1 = 500;
%k = [-MM : MM]; % [-pi, pi]
%k = [0:MM]; % [0, pi]
%w = (2*pi/MM) * k; [X1, w1] = dtft1(xn_1, [0:N-1], MM1); %[X] = dtft(xn_1, [0:N-1], w); magX1 = abs(X1); angX1 = angle(X1); realX1 = real(X1); imagX1 = imag(X1); figure('NumberTitle', 'off', 'Name', 'Problem 5.6 DTFT X(jw) of x(n)');
set(gcf,'Color','white');
subplot(2,1,1); plot(w1/pi, magX1); grid on;
title('Magnitude Part');
xlabel('frequency in \pi units'); ylabel('Magnitude');
subplot(2,1,2); plot(w1/pi, angX1); grid on;
title('Angle Part');
xlabel('frequency in \pi units'); ylabel('Phase'); figure('NumberTitle', 'off', 'Name', 'Problem 5.6 Real and Imag of X(jw)');
set(gcf,'Color','white');
subplot('2,1,1'); plot(w1/pi, realX1); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot('2,1,2'); plot(w1/pi, imagX1); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary'); %% -----------------------------------------------------------------------
%% 10-point frequency sample of X(w), DTFT of xn1 sequence
%% then IDFS to get y1(n)
%% -----------------------------------------------------------------------
y1 = real( idfs( X1(1:100:1000), 10) ); figure('NumberTitle', 'off', 'Name', 'Problem 5.6 10-point IDFS X(jw)');
set(gcf,'Color','white');
%subplot(2,1,1);
stem([0:9], y1); grid on;
title('y1(n)');
xlabel('n'); ylabel('y1'); %% -----------------------------------------------------------------------
%% 200-point frequency sample of X(w), DTFT of xn1 sequence
%% then IDFS to get y2(n)
%% -----------------------------------------------------------------------
y2 = real( idfs(X1(1:5:1000), 200) );
figure('NumberTitle', 'off', 'Name', 'Problem 5.6 200-point IDFS X(jw)');
set(gcf,'Color','white');
%subplot(2,1,1);
stem([0:199], y2); grid on;
title('y2(n)');
xlabel('n'); ylabel('y2'); %% -----------------------------------------------------------------------
%% 100-point frequency sample of X(w), DTFT of xn1 sequence
%% then IDFS to get y3(n)
%% -----------------------------------------------------------------------
y3 = real( idfs(X1(1:10:1000), 100) );
figure('NumberTitle', 'off', 'Name', 'Problem 5.6 100-point IDFS X(jw)');
set(gcf,'Color','white');
%subplot(2,1,1);
stem([0:99], y3); grid on;
title('y3(n)');
xlabel('n'); ylabel('y3');

  运行结果:

原始序列,长度为N=200,但是只有前100个元素不为零,可以看成长度为100的序列末尾补了100个零。

[-2π,2π]范围内的DTFT

[0,2π]范围内的DTFT

DTFT进行10等分采样,然后IDFS变换得到序列y1

DTFT进行200等分采样,然后IDFS变换得到序列y2

DTFT进行100等分采样,然后IDFS变换得到序列y3

由上图可知,y3(100等分DTFT再逆变换)与原始序列的非零部分相同,y2(200等分DTFT再逆变换)与原始序列完全相同,y1有畸变。

《DSP using MATLAB》Problem 5.6的更多相关文章

  1. 《DSP using MATLAB》Problem 7.27

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

  2. 《DSP using MATLAB》Problem 7.26

    注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...

  3. 《DSP using MATLAB》Problem 7.25

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

  4. 《DSP using MATLAB》Problem 7.24

    又到清明时节,…… 注意:带阻滤波器不能用第2类线性相位滤波器实现,我们采用第1类,长度为基数,选M=61 代码: %% +++++++++++++++++++++++++++++++++++++++ ...

  5. 《DSP using MATLAB》Problem 7.23

    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...

  6. 《DSP using MATLAB》Problem 7.16

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

  7. 《DSP using MATLAB》Problem 7.15

    用Kaiser窗方法设计一个台阶状滤波器. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

  8. 《DSP using MATLAB》Problem 7.14

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

  9. 《DSP using MATLAB》Problem 7.13

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

  10. 《DSP using MATLAB》Problem 7.12

    阻带衰减50dB,我们选Hamming窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

随机推荐

  1. linux操作系统及命令Part 1

    1.关于linux系统的安装与流程     (1)下载Vmware workstation 与 linux系统(centos版本.redhat版本.Ubuntu版本...)镜像. (2)详细安装见有道 ...

  2. 替代iframe

    1.jq中 通过JQuery的load()方法动态加载页面. $( "#result" ).load( "app/test.html" ); 2.vue.rea ...

  3. WPF技术实现控件截图

    1.http://www.cnblogs.com/TianFang/archive/2012/10/07/2714140.html 2.http://www.silverlightchina.net/ ...

  4. new_images

    /home/westward/Pictures/Screenshot from 2017-03-19 20:23:55.png

  5. PC/FORTH定点原理

    body, table{font-family: 微软雅黑} table{border-collapse: collapse; border: solid gray; border-width: 2p ...

  6. react全家桶-服务端与客户端配置

    全家桶内装有: react - github react-router - github redux - github react-redux - github react-router-redux ...

  7. 7.6 C++基本序列式容器效率比较

    参考:http://www.weixueyuan.net/view/6403.html 总结: 对于vector而言,它只是一个可以伸缩长度的数组 对于deque而言,它是一个可以操作头部和尾部的并且 ...

  8. 利用SMB jcifs实现对windows中的共享文件夹的操作

    需求是在本地上传文件到服务器上,服务器是windows的,使用共享文件夹提供权限给你的. 利用第三方: CIFS (Common Internet File System) SMB(Server Me ...

  9. JSONP解决跨域问题,什么是JSONP(转)

    原文链接:https://www.cnblogs.com/xinxingyu/p/6075881.html 说到AJAX就会不可避免的面临两个问题,第一个是AJAX以何种格式来交换数据?第二个是跨域的 ...

  10. struts2应用

    1.处理表单数据 GreetingAction public class GreetingAction extends ActionSupport{ private String username; ...