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

版权声明:本博客内容来自于个人学习过程中的总结,参考了互联网、数据手册、帮助文档、书本以及论文等上的内容,仅供学习交流使用,如有侵权,请联系,我会重写!转载请注明地址! https://blog.csdn.net/Reborn_Lee/article/details/83511675

如果一个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');





猜你喜欢

转载自blog.csdn.net/Reborn_Lee/article/details/83511675