matlab序列循环移位

2023-12-28 10:49:29

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

Matlab时间序列预测工具箱?

文章来源:https://blog.csdn.net/lingllllove/article/details/135255548
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。