gusucode.com > 信号处理工具箱 - signal源码程序 > signal\signal\signal\upfirdn.m
%UPFIRDN Upsample, apply a specified FIR filter, and downsample a signal. % UPFIRDN(X,H,P,Q) is a cascade of three systems applied to input signal X: % (1) Upsampling by P (zero insertion). % (2) FIR filtering with the filter specified by the impulse response % given in H. % (3) Downsampling by Q (throwing away samples). % UPFIRDN uses an efficient polyphase implementation. % % Usually X and H are vectors, and the output is a (signal) vector. % UPFIRDN permits matrix arguments under the following rules: % If X is a matrix and H is a vector, each column of X is filtered through H. % If X is a vector and H is a matrix, each column of H is used to filter X. % If X and H are both matrices with the same number of columns, then the i-th % column of H is used to filter the i-th column of X. % % Specifically, these rules are carried out as follows. Note that the length % of the output is Ly = ceil( ((Lx-1)*P + Lh)/Q ) where Lx = length(X) and % Lh = length(H). % % Input Signal X Input Filter H Output Signal Y Notes % ----------------------------------------------------------------- % 1) length Lx vector length Lh vector length Ly vector Usual case. % 2) Lx-by-Nx matrix length Lh vector Ly-by-Nx matrix Each column of X % is filtered by H. % 3) length Lx vector Lh-by-Nh matrix Ly-by-Nh matrix Each column of H is % used to filter X. % 4) Lx-by-N matrix Lh-by-N matrix Ly-by-N matrix i-th column of H is % used to filter i-th % column of X. % % UPFIRDN(X,H,P) uses Q=1 as the default. % UPFIRDN(X,H) uses P=1 and Q=1 as defaults. % % For an easy-to-use alternative to UPFIRDN, which does not require you to % supply a filter or compensate for the signal delay introduced by filtering, % use RESAMPLE. % % See also RESAMPLE, INTERP, DECIMATE, FIR1, INTFILT. % Author(s): James McClellan, 1-29-95 % Copyright (c) 1988-98 by The MathWorks, Inc. % $Revision: 1.1 $ $Date: 1998/06/03 14:44:02 $ % C MEX-file.