Geoscience Reference
In-Depth Information
f = 1*w/(2*pi);
plot(f,abs(h)), grid
xlabel('Frequency')
ylabel('Magnitude')
We can again apply the i lter to the signal by using the function filter .
Frequency-selective i lters such as lowpass, highpass, bandpass and bandstop
i lters are designed to suppress certain frequency bands, but phase shit s
should be avoided. h e function filtfilt provides zero phase-shit forward
and reverse digital i ltering. At er i ltering in the forward direction, the
i ltered sequence is reversed and runs back through the i lter. h e magnitude
of the signal is not af ected by this operation, since it is either 0 or 100% of the
initial amplitude, depending on the frequency. Any phase shit s introduced
by the i lter are canceled out by the forward and reverse application of the
same i lter. h is function also helps to overcome the problems with causal
indexing of i lters in MATLAB by eliminating the phase dif erences between
the causal and non-causal versions of the same i lter. Filtering, and then
plotting the results clearly illustrates the ef ects of the i lter.
xf12 = filtfilt(b12,a12,x12);
plot(t,x12,'b-',t,xf12,'r-')
axis([0 200 -4 4])
We might now wish to design a new i lter with a more rapid transition from
passband to stopband. Such a i lter requires a higher order, i.e., it needs
a larger number of i lter weights a12 and b12 . We now create a 15-order
Butterworth i lter as an alternative to the above i lter.
Movie
6.6
[b13,a13] = butter(15,0.1/0.5);
[h,w] = freqz(b13,a13,1024);
f = 1*w/(2*pi);
plot(f,abs(h)), grid
xlabel('Frequency')
ylabel('Magnitude')
h e frequency response is clearly improved. h e entire passband is relatively
l at at a value of 1.0, whereas the stopband is approximately zero everywhere.
We next modify our input signal by introducing a third period of 5. h is
signal is then used to illustrate the operation of a Butterworth bandstop i lter.
clear
t = 0 : 1000;
Search WWH ::




Custom Search