代码:

%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 5.18 \n\n'); banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % -------------------------------------------------------------------------------------
% X(k) is 20-point DFTs of Complex-valued sequence x(n)
% X(k) = [3cos(0.2pi*k) + j4sin(0.1pi*k)][u(k)-u(k-20)]
% N = 20 k=[0:19]
%
% xccs = [x(n)+ x*((-n))]/2 xcca = [x(n) - x*((-n))]/2
% DFT[xccs] = real(X(k)) DFT[xcca] = j*imag(X(k))
% ------------------------------------------------------------------------------------- k1 = [0:19];
Xk_DFT = (3*cos(0.2*pi*k1) + j*4*sin(0.1*pi*k1)) .* (stepseq(0,min(k1),max(k1))-stepseq(20,min(k1),max(k1)));
N1 = length(Xk_DFT); % length is 10 magXk_DFT = abs( [ Xk_DFT ] ); % DFT magnitude
angXk_DFT = angle( [Xk_DFT] )/pi; % DFT angle
realXk_DFT = real(Xk_DFT); imagXk_DFT = imag(Xk_DFT); figure('NumberTitle', 'off', 'Name', 'P5.18 X(k), DFT of x(n)')
set(gcf,'Color','white');
subplot(2,2,1); stem(k1, magXk_DFT);
xlabel('k'); ylabel('magnitude(k)');
title('magnitude DFT of x(n), N=20'); grid on;
subplot(2,2,3); stem(k1, angXk_DFT);
%axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('angle(k)');
title('angle DFT of x(n), N=20'); grid on;
subplot(2,2,2); stem(k1, realXk_DFT);
xlabel('k'); ylabel('real (k)');
title('real DFT of x(n), N=20'); grid on;
subplot(2,2,4); stem(k1, imagXk_DFT);
%axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('imag (k)');
title('imag DFT of x(n), N=20'); grid on; [xn] = idft(Xk_DFT, N1); % Complex-valued sequence
n = [0 : N1-1]; % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
% x(n) decomposition into circular-conjugate-symmetric and
% circular-conjugate-antisymmetric parts
% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[xccs, xcca] = circevod_cv(xn); % +++++++++++++++++++++++++++++++++++++++++++++++++++++++
% DFT(k) of xccs and xcca, k=[0:N1-1]
% +++++++++++++++++++++++++++++++++++++++++++++++++++++++
k1 = [0:19]; Xk_CCS_DFT = dft(xccs, length(xccs));
Xk_CCA_DFT = dft(xcca, length(xcca)); N1 = length(Yk_DFT); % length is 10 magXk_CCS_DFT = abs( [ Xk_CCS_DFT ] ); % DFT magnitude
angXk_CCS_DFT = angle( [Xk_CCS_DFT] )/pi; % DFT angle
realXk_CCS_DFT = real(Xk_CCS_DFT);
imagXk_CCS_DFT = imag(Xk_CCS_DFT); magXk_CCA_DFT = abs( [ Xk_CCA_DFT ] ); % DFT magnitude
angXk_CCA_DFT = angle( [Xk_CCA_DFT] )/pi; % DFT angle
realXk_CCA_DFT = real(Xk_CCA_DFT);
imagXk_CCA_DFT = imag(Xk_CCA_DFT); figure('NumberTitle', 'off', 'Name', 'P5.18 DFT(k) of xccs(n)')
set(gcf,'Color','white');
subplot(2,2,1); stem(k1, magXk_CCS_DFT);
xlabel('k'); ylabel('magnitude(k)');
title('magnitude DFT of xccs(n), N=20'); grid on;
subplot(2,2,3); stem(k1, angXk_CCS_DFT);
xlabel('k'); ylabel('angle(k)');
title('angle DFT of xccs(n), N=20'); grid on;
subplot(2,2,2); stem(k1, realXk_CCS_DFT);
xlabel('k'); ylabel('real (k)');
title('real DFT of xccs(n), N=20'); grid on;
subplot(2,2,4); stem(k1, imagXk_CCS_DFT);
%axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('imag (k)');
title('imag DFT of xccs(n), N=20'); grid on; figure('NumberTitle', 'off', 'Name', 'P5.18 DFT(k) of xcca(n)')
set(gcf,'Color','white');
subplot(2,2,1); stem(k1, magXk_CCA_DFT);
xlabel('k'); ylabel('magnitude(k)');
title('magnitude DFT of xcca(n), N=20'); grid on;
subplot(2,2,3); stem(k1, angXk_CCA_DFT);
xlabel('k'); ylabel('angle(k)');
title('angle DFT of xcca(n), N=20'); grid on;
subplot(2,2,2); stem(k1, realXk_CCA_DFT);
xlabel('k'); ylabel('real (k)');
title('real DFT of xcca(n), N=20'); grid on;
subplot(2,2,4); stem(k1, imagXk_CCA_DFT);
%axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('imag (k)');
title('imag DFT of xcca(n), N=20'); grid on; % --------------------------------------------------------------
% Verify
% DFT[xccs] = real(X(k)) DFT[xcca] = j*imag(X(k))
% --------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'P5.18 Verify')
set(gcf,'Color','white');
subplot(2,2,1); stem(k1, realXk_DFT);
xlabel('k'); ylabel('real(k)');
title('real DFT of x(n), N=20'); grid on;
subplot(2,2,3); stem(k1, imagXk_DFT);
xlabel('k'); ylabel('imag(k)');
title('imag DFT of x(n), N=20'); grid on; subplot(2,2,2); stem(k1, realXk_CCS_DFT);
xlabel('k'); ylabel('real (k)');
title('real DFT of xccs(n), N=20'); grid on;
subplot(2,2,4); stem(k1, imagXk_CCA_DFT);
xlabel('k'); ylabel('imag (k)');
title('imag DFT of xcca(n), N=20'); grid on; error1 = sum( abs(realXk_DFT - realXk_CCS_DFT) )
error2 = sum( abs(imagXk_DFT - imagXk_CCA_DFT) ) % ----------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'P5.18 x(n) & xccs(n)')
set(gcf,'Color','white');
subplot(2,2,1); stem(n, real(xn));
xlabel('n'); ylabel('x(n)');
title('real[x(n)], IDFT of X(k)'); grid on;
subplot(2,2,2); stem(n, real(xccs));
xlabel('n'); ylabel('xccs(n)');
title('real xccs'); grid on; subplot(2,2,3); stem(n, imag(xn));
xlabel('n'); ylabel('x(n)');
title('imag[x(n)], IDFT of X(k)'); grid on;
subplot(2,2,4); stem(n, imag(xccs));
xlabel('n'); ylabel('xccs(n)');
title('imag xccs'); grid on; % ---------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'P5.18 x(n) & xcca(n)')
set(gcf,'Color','white');
subplot(2,2,1); stem(n, real(xn));
xlabel('n'); ylabel('x(n)');
title('real[x(n)], IDFT of X(k)'); grid on;
subplot(2,2,2); stem(n, real(xcca));
xlabel('n'); ylabel('xcca(n)');
title('real xcca'); grid on; subplot(2,2,3); stem(n, imag(xn));
xlabel('n'); ylabel('x(n)');
title('imag[x(n)], IDFT of X(k)'); grid on;
subplot(2,2,4); stem(n, imag(xcca));
xlabel('n'); ylabel('xcca(n)');
title('imag xcca'); grid on;

  运行结果:

20点DFT,X(k)

圆周共轭对称序列的DFT

圆周共轭反对称的DFT

从下图看出,序列的DFT X(k)的实部与圆周共轭对称分量的DFT的实部相等;

序列的DFT X(k)的虚部与圆周共轭反对称分量的DFT的虚部相等;

圆周共轭对称序列:xccs(n)

圆周共轭反对称序列xcca(n)

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

  1. 《DSP using MATLAB》Problem 6.18

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

  2. 《DSP using MATLAB》Problem 4.18

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

  3. 《DSP using MATLAB》Problem 3.18

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

  4. 《DSP using MATLAB》Problem 2.18

    1.代码: function [y, H] = conv_tp(h, x) % Linear Convolution using Toeplitz Matrix % ----------------- ...

  5. 《DSP using MATLAB》Problem 8.18

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

  6. 《DSP using MATLAB》Problem 5.15

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

  7. 《DSP using MATLAB》Problem 4.15

    只会做前两个, 代码: %% ---------------------------------------------------------------------------- %% Outpu ...

  8. 《DSP using MATLAB》Problem 7.27

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

  9. 《DSP using MATLAB》Problem 7.26

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

随机推荐

  1. java字符串根据空格截取并存进ArrayList,并在每个元素前后加上/

    public class List { public static void main(String[] args) { String s = "abc nnn ooo/xzsxc bs&q ...

  2. RabbitMQ arguments参数设置

    有发布端.消费端.消息路由.消息生命周期和身份认证标识等模块参数的设置. 具体请参考地址:http://www.rabbitmq.com/extensions.html

  3. 【转载】Maven中的BOM概念

    1.概述 1.1.什么是 BOM? BOM stands for Bill Of Materials. A BOM is a special kind of POM that is used to c ...

  4. linux centos7 安装mono

    1.看官方的命令: 另外一种是下载压缩包解压之后安装: https://apps.fedoraproject.org/packages/mono/ 三.安装Mono需要的GDI+兼容API的库Libg ...

  5. SQL3-查找各个部门当前(to_date='9999-01-01')领导当前薪水详情以及其对应部门编号dept_no

    题目描述 查找各个部门当前(to_date='9999-01-01')领导当前薪水详情以及其对应部门编号dept_noCREATE TABLE `dept_manager` (`dept_no` ch ...

  6. Android:E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7f9d1b41c0

    这个问题是在测试leakCanaryTestDemo时发现的,期初看到有点蒙,这个demo中只使用了一个button和一个textView控件进行测试,按理说是不应该出现这种问题,在 网上查找这个问题 ...

  7. Nginx日志和http模块相关变量

    $arg_PARAMETER #HTTP 请求中某个参数的值,如/index.php?site=www.ttlsa.com,可以用$arg_site 取得 www.ttlsa.com 这个值. $ar ...

  8. 惊不惊喜, 用深度学习 把设计图 自动生成HTML代码 !

    如何用前端页面原型生成对应的代码一直是我们关注的问题,本文作者根据 pix2code 等论文构建了一个强大的前端代码生成模型,并详细解释了如何利用 LSTM 与 CNN 将设计原型编写为 HTML 和 ...

  9. ChinaCock界面控件介绍-TCCYearMonthSelector

    Delphi原生控件支持日期的选择,但对于只选择年月的情况,则没有好的实现.TCCYearMonthSelector正是为解决这个问题而产生的.看看运行效果图: 用法一如即往的简单,这是一个不可视控件 ...

  10. JetBrains Goland 2018.2.1最新版破解

    JetBrains GoLand 2018.2.1破解版是JetBrains的新商业IDE,旨在为Go开发提供符合人体工程学的环境.新的IDE通过特定于Go语言的编码辅助和工具集成扩展了Intelli ...