Geoscience Reference
In-Depth Information
We obtain an output vector
y6
of the same length and phase as the input
vector
x6
. We now plot the results for comparison.
stem(t,x6)
hold on
stem(t,y6,'filled','r')
axis([0 20 -2 2])
hold off
In contrast to
plot
, the function
stem
accepts only one data series and the
second series
y6
is therefore overlaid on the same plot using the function
hold
. h e ef ect of the i lter is clearly seen on the plot: it averages the unit
impulse over a length of i ve elements. Furthermore, the values of the output
y6
equal the i lter weights of
a6
; in our example these values are 0.2 for all
elements of
a6
and
y6
.
For a recursive i lter, however, the output
y6
does not match the i lter
weights. Once again, we i rst generate an impulse:
clear
t = (0:20)';
x7 = [zeros(10,1);1;zeros(10,1)];
An arbitrary recursive i lter with weights of
a7
and
b7
is then designed.
b7 = [0.0048 0.0193 0.0289 0.0193 0.0048];
a7 = [1.0000 -2.3695 2.3140 -1.0547 0.1874];
m7 = length(b7);
y7 = filter(b7,a7,x7);
y7 = y7(1+(m7-1)/2:end-(m7-1)/2,1);
y7(end+1:end+m7-1,1) = zeros(m7-1,1);
h e stem plot of the input
x2
and the output
y2
shows an interesting impulse
response:
stem(t,x7)
hold on
stem(t,y7,'filled','r')
axis([0 20 -2 2])
hold off
h e signal is smeared over a broader area, and is also shit ed towards the
right. h is i lter therefore not only af ects the amplitude of the signal, but
also shit s the signal towards lower or higher values. Such phase shit s are
usually unwanted characteristics of i lters, although in some applications
shit s along the time axis might be of particular interest.