⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 circonvt.m

📁 很多matlab的源代码
💻 M
字号:
function y = circonvt(x1,x2,N)
% N-point circular convlution between x1 and x2 ; (time-domain)
% -----------------------------------------------------------------
% [y] = circonvt(x1,x2,N)
% y = output seqence containing the circular convolution
% x1 = input sequence of length N1 <= N
% x2 = input sequence of length N2 <= N
% N = size of circular buffer
% Method: y(n) = sum (x1(m)*x2(n-m) mod N)
% check for length x1
if length(x1)>N
    error('N must be >= the length of x1')
end
% check for length x2
if length(x2)>N
    error('N must be >= the length of x2')
end
x1=[x1 zeros(1,N-length(x1))];
x2=[x2,zeros(1,N-length(x2))];
m=[0:1:N-1];
x2=x2(mod(-m,N)+1);
H=zeros(N,N);
for n = 1:1:N
    H(n,:) = cirshftt(x2,n-1,N);
end
y=x1*H';
H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -