Geoscience Reference
In-Depth Information
with a frequency close to zero (Fig. 5.7).
[Pxx,f] = periodogram(x,[],1024,1);
[Pxxt,f] = periodogram(xt,[],1024,1);
subplot(1,2,1)
plot(f,Pxx), grid
xlabel('Frequency')
ylabel('Power')
subplot(1,2,2)
plot(f,Pxxt), grid
xlabel('Frequency')
ylabel('Power')
To eliminate the long-term trend, we use the function
detrend
. h is function
removes linear trends, dei ned as either a single straight-line i t from the
vector
x
, or a continuous, piecewise linear trend from
x
with one or more
breakpoints dei ned by the user.
xdt = detrend(xt);
subplot(2,1,1)
plot(t,x,'b-',t,xt,'r-'), grid
axis([0 200 -4 4])
subplot(2,1,2)
plot(t,x,'b-',t,xdt,'r-'), grid
axis([0 200 -4 4])
b
a
Fig. 5.7
Comparison of the auto-spectra for
a
the original noise-free signal with the periods
˄
1
=50 (
f
1
=0.02), ˄
2
=15 (
f
2
≈0.07) and ˄
3
=5 (
f
3
=0.2), and
b
the same signal overprinted on a
linear trend. h e linear trend is misinterpreted by the FFT as a very long period with a high
amplitude.