【 MATLAB 】DFT的性质讨论(二)序列的循环移位及其 MATLAB 实现(时域方法)

论坛 期权论坛 脚本     
匿名技术用户   2020-12-28 04:43   112   0

如果一个N点序列在任一方向上移位,那么其结果都不在是位于 0 < = n <= N-1之间。因此,需要进行下面的操作:

为了形象化,可以设想将序列x(n)放在一个圆上,现在将这个圆旋转k个样本,并从 0 < = n <= N-1展开这个序列。

它的DFT给出为:


下面给出循环移位的函数:

function y = cirshftt(x,m,N)
% Circular shift of m samples in sequence x over 0:N-1(time domain)
% _________________________________________________________________
% y = cirshftt(x,m,N)
% y = output sequence containing the circular shift
% x = input sequence of length <= N
% N = size of circular buffer
% Method: y(n) = x( (n-m) mod N )
% Check for length of x
if length(x) > N 
    error('N must be >= the length of x');
end
x = [x,zeros(1,N-length(x))];
n = [0:1:N-1];
n = mod(n-m,N);
y = x(n+1);

下面给出一个案例,实现循环移位:

已知一个11点的序列x(n) = 10(0.8)^n,0 \leq n \leq 10

a.求出并画出循环左移4个样本后的序列;

b.假设x(n)是一个15点序列(补零),求出循环右移3个样本后的序列。

clc
clear
close all
 
 
n = 0:1:10;
x = 10 * (0.8).^n;
N = 11;
m = -4;
y1 =  cirshftt(x,m,N);

subplot(2,2,1);
stem(n,x);
title('x(n) with n over [0,10]');
xlabel('n');

subplot(2,2,2);
stem(n,y1);
title('circularly left shift for 4');
xlabel('n');




x = [x,zeros(1,4)];
n = 0:1:14;
N = 15;
m = 3;
y2 = cirshftt(x,m,N);

subplot(2,2,3);
stem(n,x);
title('x(n) with n over [0,15] by padding 0');
xlabel('n');

subplot(2,2,4);
stem(n,y2);
title('circularly right shift for 3');
xlabel('n');





分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP