<< Chapter < Page | Chapter >> Page > |
While the calculations of a linear filter are usually carried out in the time domain, filters are oftenspecified in the frequency domain. Indeed, the words used to specify filters(such as lowpass, highpass, and bandpass) describe how the filter acts on the frequency content of its input. [link] , for instance, shows a noisy input entering three different filters.The frequency response of the LPF shows that it allows low frequencies (those below the cutofffrequency ) to pass, while removing all frequencies above the cutoff.Similarly, the HPF passes all the high frequencies and rejects those below its cutoff . The frequency response of the BPF is specified by two frequencies.It will remove all frequencies below and remove all frequencies above , leaving only the region between.
[link] shows the action of ideal
filters. How close are actual implementations? The M
atlab code in
filternoise.m
shows that it is possible
to create digital filters that reliably andaccurately carry out these tasks.
time=3; % length of time
Ts=1/10000; % time interval between samplesx=randn(1,time/Ts); % generate noise signal
figure(1),plotspec(x,Ts) % draw spectrum of inputfreqs=[0 0.2 0.21 1];amps=[1 1 0 0];b=firpm(100,freqs,amps); % specify the LP filter
ylp=filter(b,1,x); % do the filteringfigure(2),plotspec(ylp,Ts) % plot the output spectrum
freqs=[0 0.24 0.26 0.5 0.51 1];
amps=[0 0 1 1 0 0];
b=firpm(100,freqs,amps); % BP filterybp=filter(b,1,x); % do the filtering
figure(3),plotspec(ybp,Ts) % plot the output spectrumfreqs=[0 0.74 0.76 1];amps=[0 0 1 1];b=firpm(100,freqs,amps); % specify the HP filter
yhp=filter(b,1,x); % do the filteringfigure(4),plotspec(yhp,Ts) % plot the output spectrum
filternoise.m
filter a noisy signal three ways
(download file)
The output of
filternoise.m
is shown in
[link] . Observe that the spectra
at the output of the filters are close approximations tothe ideals shown in
[link] .
There are some differences, however.While the idealized spectra are completely flat in the
passband, the actual ones are rippled.While the idealized spectra completely reject
the out-of-band frequencies, the actual oneshave small (but nonzero) energy at all frequencies.
Two new M
atlab commands are used in
filternoise.m
.
The
firpm
Some early versions
of M
atlab use the name
remez
for the same
command. command specifies the contour of the
filter as a line graph. For instance, typing
plot([0 0.24 0.26 0.5 0.51 1],[0 0 1 1 0 0])
at the M
atlab prompt draws a box that represents the
action of the BPF designed in
filternoise.m
(over
the positive frequencies).The frequencies are specified as percentages of
, which in this
case is equal to 5000 Hz. (
is discussed
further in the next section.)Thus the BPF in
filternoise.m
passes
frequencies between 0.26x5000 Hz to 0.5x5000 Hz,and rejects all others.
The
filter
command uses the output of
firpm
to carry out the filtering operation on the vector
specified in its third argument. More details aboutthese commands are given in the section on practical
filtering in
[link] .
Notification Switch
Would you like to follow the 'Software receiver design' conversation and receive update notifications?