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

📄 f_conv.asv

📁 DSP程序 Matlab是一套用于科学工程计算的可视化高性能语言与软件环境。它集数值分析、矩阵运算、信号处理和图形显示于一体
💻 ASV
字号:
function y = f_conv (h,x,circ)

%F_CONV: Fast linear or circular convolution
%
% Usage: y = f_conv (h,x,circ)
%
% Inputs: 
%         h    = vector of length L containing pulse 
%                response signal
%         x    = vector of length M containing input signal
%         circ = convolution type code:
%
%                0 = linear convolution
%                1 = circular convolution (requires M = L)
% Outputs: 
%          y = vector of length L+M-1 containing the 
%              convolution of h with x 
%
% Note: If h is the impulse response of a discrete-time 
%       linear system and x is the input, then y is the 
5       zero-state 
%       response when circ = 0.
%         
% See also: F_BLOCKCONV, F_CORR, CONV, DECONV

% Initialize

L = length(h);
M = length(x);
if circ
   N = min(L,M);
else
   N = 2^ceil(log(L+M-1)/log(2));
end

% Compute convolution

H = fft(f_tocol(h),N);
X = fft(f_tocol(x),N);
r = ifft(H .* X);
if circ
   y = real(r);
else
   y(1:L+M-1) = real(r(1:L+M-1));
end

⌨️ 快捷键说明

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