<< Chapter < Page | Chapter >> Page > |
Filters are also classified by the length of their impulse response. If the output of a filter depends only ona specified number of samples, the filter is said to have a finite impulse response, abbreviated FIR. Otheriwse,it is said to have an infinite impulse response, abbreviated IIR.The bulk of the filters in Software Receiver Design are FIR filters with a flat passband, because these are the most commonfilters in a typical receiver. But other filter profiles are possible, and the techniques offilter design are not restricted to flat passbands. "Implementing FIR Filters" shows several ways that digital FIR filters can be implemented in M atlab . IIR filters arise whenever there is a loop(such as in a phase locked loop), and one special case (the integrator) is an intrinsic piece of theadaptive elements. "Implementing IIR Filters" shows how to implement IIR filters. "Filter Design" shows how to design filters with specific properties,and how they behave on a number of test signals.
Suppose that the impulse response of a discrete-time filter is , . If the input to the filter is the sequence , , then the output is given by the convolution [link] . There are four ways to implement this filtering in M atlab :
conv
directly implements the convolution equation
and outputs a vector of length
.filter
implements the convolution so as to supply one output
value for each input value; the output is of length
.Probably the easiest way to see the differences is to play with the four methods.
h=[1 -1 2 -2 3 -3]; % impulse response h[k]x=[1 2 3 4 5 6 -5 -4 -3 -2 -1]; % input data x[k]yconv=conv(h,x) % convolve x[k]*h[k]yfilt=filter(h,1,x) % filter x[k] with h[k]n=length(h)+length(x)-1; % pad length for FFT
ffth=fft([h zeros(1,n-length(h))]); % FFT of impulse response = H[n]
fftx=fft([x, zeros(1,n-length(x))]); % FFT of input = X[n]
ffty=ffth.*fftx; % product of H[n] and X[n]
yfreq=real(ifft(ffty)) % IFFT of product gives y[k]z=[zeros(1,length(h)-1),x]; % initial state in filter = 0for k=1:length(x) % time domain method
ytim(k)=fliplr(h)*z(k:k+length(h)-1)'; % iterates once for each x[k]end % to directly calculate y[k]
waystofilt.m
“conv” vs. “filter” vs. “freq domain” vs. “time domain”
(download file)
Observe that the first
M
terms of
yconv
,
yfilt
,
yfreq
, and
ytim
are
the same, but that both
yconv
and
yfreq
have
N-1
extra values at the end.
For both the time domain method and the
filter
command,
the output values are aligned in time with the input values,one output for each input. Effectively, the
filter
command is a single
line implementation of the time domain
for
loop.
Notification Switch
Would you like to follow the 'Software receiver design' conversation and receive update notifications?