代码:

%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 5.7 \n\n'); banner();
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % --------------------------------------------------
% 1 x(n) = [ 2,4,6,1,3,5 ] N--period
% |
% --------------------------------------------------
x = [2, 4, 6, 1, 3, 5]; N = 6; n = [0 : N-1]; % periodic sequence with period N
y = x( mod(-n, N)+1 ); % circular fold figure('NumberTitle', 'off', 'Name', 'P5.7 x(n) and x(-n)')
set(gcf,'Color','white');
subplot(2,1,1); stem(n, x);
xlabel('n'); ylabel('x(n)');
title('$\tilde x(n) sequence, period N=6$', 'interpreter', 'latex', 'fontsize', 14); grid on;
subplot(2,1,2); stem(n, y);
xlabel('n'); ylabel('y(n)');
title('x(-n) sequence'); grid on; %% ------------------------------------------------------------------
%% DFS(k) of xn sequence, k=[0:N-1], N=6
%% ------------------------------------------------------------------
k1 = [0 : length(x)-1];
%k2 = [-N : N-1];
%k3 = [-N/2 : N/2];
Xk_1 = dfs(x, N); % DFS
magXk = abs( [ Xk_1 ] ); % DFS magnitude
angXk = angle( [Xk_1] )/pi; % DFS angle figure('NumberTitle', 'off', 'Name', 'P5.7 DFS(k) of x(n)')
set(gcf,'Color','white');
subplot(2,1,1); stem(k1, magXk); %axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('magnitude(k)');
title('DFS magnitude of x(n), N=6'); grid on;
subplot(2,1,2); stem(k1, angXk); %axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('angle(k)');
title('DFS angle of x(n), N=6'); grid on; %% ------------------------------------------------------------------
%% DFS(k) of yn sequence, k=[0:N-1], N=6
%% ------------------------------------------------------------------
k1 = [0 : length(y)-1];
%k2 = [-N : N-1];
%k3 = [-N/2 : N/2];
Yk_1 = dfs(y, N); % DFS
magYk = abs( [ Yk_1 ] ); % DFS magnitude
angYk = angle( [Yk_1] )/pi; % DFS angle figure('NumberTitle', 'off', 'Name', 'P5.7 DFS(k) of y(n)')
set(gcf,'Color','white');
subplot(2,1,1); stem(k1, magYk); %axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('magnitude(k)');
title('DFS magnitude of y(n), N=6'); grid on;
subplot(2,1,2); stem(k1, angYk); %axis([-N/2, N/2, -0.5, 50.5]);
xlabel('k'); ylabel('angle(k)');
title('DFS angle of y(n), N=6'); grid on;

  运行结果:

周期序列及其圆周折叠序列:

原始序列的DFS系数

圆周折叠序列的DFS系数

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

  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. C++解析四-友员函数、内联函数、静态成员

    友元函数 类的友元函数是定义在类外部,但有权访问类的所有私有(private)成员和保护(protected)成员.尽管友元函数的原型有在类的定义中出现过,但是友元函数并不是成员函数.友元可以是一个函 ...

  2. Linux command parted

    Linux command parted [Purpose]        Learning linux command parted to manipulate disk partitions   ...

  3. 前端常用长度单位(px,em,rem,pt)介绍

    CSS中有不少属性是以长度作为值的.盒模型的属性就是一些很明显的值属性:width.height.margin.padding.border.除此之外还有很多其他的CSS属性的值同样也是长度值,像偏移 ...

  4. 基于Redis+MySQL+MongoDB存储架构应用

    摘  要: Redis+MySQL+MongoDB技术架构实现了本项目中大数据存储和实时云计算的需求.使用MongoDB切片的水平动态添加,可在不中断平台业务系统的同时保障扩容后的查询速度和云计算效能 ...

  5. Mysql数据库操作语句总结

    简单复习下: 增insert into -- 删 delete from  -- 改 update table名字 set -- 查 select * from  -- 一.SQL定义 SQL(Str ...

  6. swiftlint swift代码规范检查神器

    一大堆的你为什么要用swiftlint,你为什么要codereview,swiftlint到底在做什么,就不多说了,没意义,他就是帮助你写出规范漂亮代码的神器! 安装 官方提供了三种安装的方式 hom ...

  7. Linux输入子系统 : 按键驱动

    一.Linux input system框架: 1.由输入子系统核心层(input.c),驱动层(gpio_keys.c)和事件处理层(Event Handler)三部份组: 2.主要的三个结构体:i ...

  8. UUID+随机数

    import java.util.Random; import java.util.UUID; public class UUIDUtils { public static String getUUI ...

  9. 查看文件 ls -lh

    查看文件 ll ls -l --block-size=k ls -lh

  10. java8 字符串转换 list long Integer

    String ids= "1,2,3,4,5,6"; List<Long> listIds = Arrays.asList(ids.split("," ...