matlab序列循环移位

matlab序列循环移位_第1张图片

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)');

Matlab时间序列预测工具箱 

你可能感兴趣的:(开发语言)