fir.m

来自「This getting started exercise will guide」· M 代码 · 共 34 行

M
34
字号
%       AccelDSP 8.1.1 build 690 Production, compiled Apr 26 2006 
% 
%    THIS IS UNPUBLISHED, LICENSED SOFTWARE THAT IS THE CONFIDENTIAL 
%        AND PROPRIETARY PROPERTY OF XILINX OR ITS LICENSORS 
% 
%     Copyright(c) Xilinx, Inc., 2000-2006, All Rights Reserved. 
%     Reproduction or reuse, in any form, without the explicit written 
%     consent of Xilinx, Inc., is strictly prohibited. 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Description : Function definition for general FIR filter design            %
%%                                                                            %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function outdatabuf=fir(indatabuf)

% Load the filter coefficients
coeff = load('coefficients.txt');

persistent tap_delay;

% Clear tap delay line at beginning
if isempty(tap_delay)
  tap_delay = zeros(1,length(coeff));
end

% Perform sum of products
outdatabuf = tap_delay * coeff(end:-1:1)';

% Shift tap delay line
tap_delay = [tap_delay(2:length(coeff)) indatabuf];



⌨️ 快捷键说明

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