Geoscience Reference
In-Depth Information
b1 = [1 1 1]/3;
y1 = conv(x1,b1);
We u s e
deconv
to reverse the convolution and compare the deconvolution
result
x1d
with the original signal
x1
.
x1d = deconv(y1,b1);
plot(t,x1,'b:',t,x1d,'r')
As we can see, there is no dif erence. h ere is a dif erence, however, if we add
noise to the signal and deconvolve the result by typing
y1n = y1 + 0.05*randn(size(y1));
x1nd = deconv(y1n,b1);
plot(t,x1,'b:',t,x1nd,'r')
h e next section provides a broader dei nition of i lters.
6.5 Comparing Functions for Filtering Data Series
h e i lters described in the previous section were very simple examples of
nonrecursive i lters
, in which the i lter output
y
(
t
) depends only on the i lter
input
x
(
t
) and the i lter weights
b
k
. Prior to introducing a broader description
of linear time-invariant i lters, we replace the function
conv
by
filter
, which
can also be used for
recursive i lters
. In this case, the output
y
(
t
n
) depends not
only on the i lter input
x
(
t
), but also on previous elements of the output
y
(
t
n-
1
),
y
(
t
n-
2
),
y
(
t
n-
3
) and so on (Section 6.6). We will i rst use
conv
for nonrecursive
i lters in order to compare the results of
conv
and
filter
.
clear
t = (1:100)';
rng(0)
x3 = randn(100,1);
We design a i lter that averages i ve data points of the input signal.
b3 = [1 1 1 1 1]/5;
m3 = length(b3);
h e input signal can be convolved using the function
conv
.
y3 = conv(x3,b3,'same');
We next follow a similar procedure with the function
filter
and compare the
result with that obtained using the function
conv
. In contrast to the function