序列循环移位

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 16:52   2138   0

image

function m = mod(n,N)
%computes m = mod(n mod N)
%___________________
%m = mod(n,N)
m = rem(n,N);
m = m+N;
m = rem(m,N);

function y = cirshiftt(x,m,N)
%circular shift of m samples wrt size N in sequnce x:
%-----------------------------------------------------
%[y] = cirshiftt(x,m,N)
%y = output sequence containing the circular shift
%;x = input sequence of length <= N
% m = simple shift
% 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);

n = 0:10 ;
x = 10*(0.8).^n;
y = cirshiftt(x,6,15);
n = 0: 14;
x = [x,zeros(1,4)];
subplot(2,1,1);
stem(n,x);
title('oringnal signal');
subplot(2,1,2);
stem(n,y);
title('x((n-m) mod 15)');

转载于:https://www.cnblogs.com/sleepy/archive/2011/07/02/2096316.html

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

本版积分规则

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

下载期权论坛手机APP