Random Processes, Correlation, and Power Spectral Density

advertisement
Random Processes, Correlation, and
Power Spectral Density
CEE 541. Structural Dynamics
Department of Civil and Environmental Engineering
Duke University
Henri P. Gavin
Fall 2016
1 Random Processes
A random process X(t) is a set (or “ensemble”) of m random variables expressed as a function
of time (and/or some other independent variables).



X(t) = 


X1 (t)
X2 (t)
..
.






Xm (t)
For example, if X(t) represents be the wind at the top of the Cape Hatteras light house from
12:00 pm to 1:00 pm, then Xj (t) would be the wind speed at the top of the Cape Hatteras
light house from 12:00 pm to 1:00 pm on the j th day of the year.
1.1 Ensemble Average
The ensemble average is the average across the variables in the ensemble at a fixed point in
time, t.
m
1 X
g(Xj (t))
E[g(X(t))] = E[g(X1 (t)), g(X2 (t)), · · · , g(Xm (t))] ≈
m j=1
In general the ensemble average can change with time. A random process X is stationary if
ensemble averages are independent of time:
E[g(X(t1 ))] = E[g(X(t2 ))] ∀ t1 , t2
1.2 Time Average
The time average is the average along time for a variable Xj (t) in the ensemble.
1 Z T /2
g(Xj (t)) dt
hg(Xj )i = lim
T →∞ T −T /2
1.3 Ergodic processes
A random process X is ergodic if its ensemble averages equal its time averages:
E[g(X(ti ))] = hg(Xj )i ∀ i, j
Ergodic processes are stationary.
2
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
sample records from a stationary and ergodic process
65
sample record number
60
55
50
45
40
35
0
2
4
6
8
10
time, sec
sample records from a stationary but not ergodic process
65
sample record number
60
55
50
45
40
35
0
2
4
6
8
10
time, sec
CC BY-NC-ND H.P. Gavin
3
Power Spectral Density
The statistics of an ergodic process X(t) can be found from any single record Xj (t) from the
ensemble.
• mean value
n
1 Z T /2
1X
Xj (t) dt = lim
xj (ti )
n→∞ n
T →∞ T −T /2
i=1
hX(t)i = E[X(t)] = lim
• mean-square value
D
n
1 Z T /2 2
1X
Xj (t) dt = lim
x2j (ti )
n→∞ n
T →∞ T −T /2
i=1
E
X 2 (t) = E[X 2 (t)] = lim
• variance
2
σX
= E[X 2 ] − (E[X])2
2 The Fourier Transform Pair and the Dirac delta function
Z ∞
x(t) =
X̄(f ) exp(+i2πf t) df
−∞
Z ∞
X̄(f ) =
x(t) exp(−i2πf t) dt
−∞
If x(t) is complex, then
Z ∞
x∗ (t) =
X̄ ∗ (f ) exp(−i2πf t) df
−∞
If x(t) is real, then X̄(f ) = X̄ ∗ (−f ).
Recall the property of the Dirac delta function, δ(t),
Z ∞
δ(t − t0 )x(t0 )dt0 = x(t)
−∞
and apply the forward and inverse Fourier transforms to x(t),
x(t) =
=
=
Z ∞ Z ∞
−∞
Z ∞
−∞
Z ∞
−∞
Z ∞
−∞
0
x(t )e
−i2πf t0
i2πf (t−t0 )
e
0
dt
e+i2πf t df
df x(t0 ) dt0
δ(t − t0 ) x(t0 ) dt0
−∞
So the unit Dirac delta function has a unit Fourier spectrum.
δ(t − t0 ) =
Z ∞
0
(1)e+i2πf (t−t ) df ,
−∞
A similar relation can be found by applying the Fourier transforms in the opposite order,
and gives the Fourier transform of x(t) = (1) cos(2πf 0 t).
0
δ(f − f ) =
Z ∞
0
(1)e−i2π(f −f )t dt .
−∞
CC BY-NC-ND H.P. Gavin
4
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
3 Parseval’s Theorem
For (generally) complex-valued funtions x(t),
Z ∞
−∞
x∗1 (t)x2 (t) dt =
Z ∞
−∞
X̄1∗ (f )X̄2 (f ) df
The proof of Parseval’s theorem involves the Fourier transform of the Dirac delta function:
Z ∞
−∞
x∗1 (t)x2 (t)
dt =
Z ∞ Z ∞
−∞
=
Z ∞ Z ∞ Z ∞
−∞
=
Z ∞
−∞
=
−∞
Z ∞ Z ∞
−∞
=
−∞
Z ∞ Z ∞
−∞
=
−∞
X̄1∗ (f )e−i2πf t df
Z ∞
−∞
−∞
−∞
−∞
+i2πf 0 t
X̄2 (f )e
df
0
dt
0
X̄1∗ (f )X̄2 (f 0 ) e+i2πf t e−i2πf t df df 0 dt
X̄1∗ (f )X̄2 (f 0 )
X̄1∗ (f )X̄2 (f 0 )
X̄1∗ (f )
Z ∞
Z ∞
−∞
Z ∞
i2π(f 0 −f )t
e
dt df 0 df
−∞
δ(f 0 − f ) df 0 df
0
0
X̄2 (f ) δ(f − f ) df
0
df
X̄1∗ (f )X̄2 (f ) df
If x1 (t) and x2 (t) are both real, then x∗1 (t) = x1 (t) but X̄1∗ (f ) 6= X̄1 (f ), so,
Z ∞
−∞
and further,
Z ∞
−∞
2
x1 (t)x2 (t) dt =
x (t) dt =
Z ∞
−∞
∗
Z ∞
−∞
X̄1∗ (f )X̄2 (f ) df
X̄ (f )X̄(f ) df =
Z ∞
|X̄(f )|2 df
−∞
CC BY-NC-ND H.P. Gavin
5
Power Spectral Density
4 Auto-correlation
The covariance of X(t) with X(t + τ ) is
1 Z T /2
x(t) · x(t + τ ) dt
T →∞ T −T /2
n
1 X
= lim
x(ti ) · x(ti + τ )
n→∞ n + 1
i=1
RXX (τ ) = hX(t)X(t + τ )i = E[X(t) · X(t + τ )] =
lim
If X is ergodic (E[g(Xj (t1 )] = E[g(Xj (t2 )] ∀ j, t1 , t2 ), then RXX is time-independent.
2
2
.
and RXX (0) is the variance, σX
If X is zero-mean (E[Xj (t)] = 0 ∀ j), then E[X 2 (t)] = σX
The auto-correlation function is symmetric: RXX (−τ ) = RXX (τ ), and |RXX (τ )| ≤ RXX (0).
4.1 Auto Power Spectral Density
The auto power spectral density SXX (f ) is defined by
1 ∗
X̄ (f )X̄(f )
T →∞ T
SXX (f ) = lim
and has the following properties:
•
D
E
X 2 (t) =
Z ∞
−∞
SXX (f ) df
proof:
D
E
X 2 (t)
1 Z T /2 2
x (t) dt
T →∞ T −T /2
Z ∞
1 2
lim
=
x (t) dt
−∞ T →∞ T
Z ∞
1 ∗
=
lim
X̄ (f )X̄(f ) df · · · Parseval
−∞ T →∞ T
Z
=
lim
∞
=
−∞
SXX (f ) df
CC BY-NC-ND H.P. Gavin
6
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
•
RXX (τ ) =
Z ∞
−∞
SXX (f ) exp(+i2πf τ ) df
proof:
x(t + τ ) =
Z ∞
X̄(f ) e+i2πf (t+τ ) df
−∞
1 Z T /2
RXX (τ ) = lim
x(t) · x(t + τ ) dt
T →∞ T −T /2
Z ∞
1 Z T /2
+i2πf (t+τ )
X̄(f ) e
df dt
= lim
x(t) ·
T →∞ T −T /2
−∞
Z ∞
Z ∞
1
=
lim
x(t)
X̄(f ) ei2πf t ei2πf τ df dt
−∞ T →∞ T
−∞
Z ∞
Z ∞
1
i2πf t
lim
x(t)e
dt X̄(f ) ei2πf τ df
=
T
→∞
T
−∞
−∞
Z ∞
1 ∗
lim
=
X̄ (f )X̄(f ) ei2πf τ df
−∞ T →∞ T
Z
∞
=
−∞
SXX (f ) ei2πf τ df · · · Weiner − Khintchine
Note that the power spectral density is a density function. If the process X(t) has units of
‘m’ (meters), and the circular frequency, f , is the independent variable (with units of ‘Hz’ or
‘cycles/sec’), then the units of of the power spectral density is SXX (f ) is ‘m2 /Hz’.
Alternatively, if the angular frequency ω is the Independent variable (dω = 2π df ), then the
units of the power spectral density SXX (ω) is ‘m2 /(rad/s)’.
So, to convert between frequencies f and ω, the value of the power spectral density needs to
be scaled as well.
SXX (ω) dω = 2πSXX (f ) df
4.2 One-sided Power Spectral Density
The one-sided power spectral density function GXX (ω) is defined so that
D
2
E
X (t) =
Z ∞
0
GXX (ω) dω =
Z ∞
0
Z ∞
dω
GXX (2πf )
df = 2π
GXX (f ) df
df
0
Since SXX (f ) is symmetric about f = 0,
D
2
E
X (t) = 2
Z ∞
0
SXX (f ) df ,
so, the symmetric, two-sided SXX (f ) is related to the one-sided GXX (f ) as
SXX (f ) df = π GXX (|f |) df
CC BY-NC-ND H.P. Gavin
7
Power Spectral Density
5 Cross-correlation
The covariance of X(t) with Y (t + τ ) is
1 Z T /2
x(t) · y(t + τ ) dt
T →∞ T −T /2
n
1 X
= lim
x(ti ) · y(ti + τ )
n→∞ n + 1
i=1
RXY (τ ) = hX(t)Y (t + τ )i = E[X(t) · Y (t + τ )] =
lim
If X and Y are ergodic random processes (E[g(X(t1 )] = E[g(X(t2 )] ∀ t1 , t2 and E[g(Y (t1 )] =
E[g(Y (t2 )] ∀ t1 , t2 ), then RXY (τ ) is independent of time.
If X and Y are zero-mean random processes (E[X(t)] = 0 and E[Y (t)] = 0),
then RXY (0) = E[X(t)Y (t)] which is the covariance of X and Y , V[X, Y ].
The cross-correlation function is not symmetric: RXY (−τ ) 6= RXY (τ ).
5.1 Cross Power Spectral Density
The cross-power spectral density is defined as
1
1 ∗
∗
X̄ (f ) Ȳ (f ) = lim
X̄(−f ) Ȳ ∗ (−f ) = SXY
(−f )
T →∞ T
T →∞ T
SXY (f ) = lim
RXY (τ ) =
Z ∞
−∞
SXY (f ) exp(i2πf τ ) df · · · Weiner − Khintchine
6 Derivatives of Auto-Correlations and Power Spectral Density of Derivatives
Recall
RXX (τ ) = hX(t)X(t + τ )i = E[X(t) · X(t + τ )]
So
and
D
E
D
E
d
0
RXX (τ ) = RXX
(τ ) = X(t)Ẋ(t + τ ) = Ẋ(t)X(t + τ )
dτ
D
E
d2
00
R
(τ
)
=
R
(τ
)
=
−
Ẋ(t)
Ẋ(t
+
τ
)
= −RẊ Ẋ (τ )
XX
XX
dτ 2
Thus,
SẊ Ẋ (f ) = (f )2 SXX (f ) and
SẌ Ẍ (f ) = (f )4 SXX (f )
CC BY-NC-ND H.P. Gavin
8
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
7 Examples
• Dirac delta function x(t) = δ(t)
Z ∞
X̄(f ) =
δ(t) exp(−i2πf t) dt
=1
−∞
limT →∞ T1 X̄(f )X̄ ∗ (f )
SXX (f ) =
RXX (τ ) =
Z ∞
−∞
=0
SXX (f ) exp(i2πf τ ) df = 0
Z ∞
RXX (0) =
δ(t)2 dt
=∞
−∞
• Finite duration pulse
(
x(t) =
X̄(f ) =
1 + cos(πt/Tp ) −Tp < t < Tp
0
t < −Tp , Tp < t
Z Tp
−Tp
cos(πt/Tp ) exp(−i2πf t) dt =
2 sin(πf Tp ) cos(πf Tp )
πf (1 − 4πf 2 Tp2 )
• Band-limited white noise
(
So −fc < f < fc
0 f < −fc , fc < f
1
RXX (τ ) =
sin(2πfc τ )
πfc τ
SXX (f ) =
|X̄(f )| =
x(t) ≈
q
2SXX (f ) df
n/2 q
X
2 SXX (fk ) ∆f (cos(2πfk t + θk ))
k=1
where fk = (k∆f ) and θ is a random variable uniformly distributed between 0 and π.
CC BY-NC-ND H.P. Gavin
9
Power Spectral Density
8 Computation with discrete-time signals
1
2
3
4
5
% PowerSpectra .m −−− 10 November 2014
n = 1024;
% number o f p o i n t s i n t h e time−s e r i e s
dt = 0.010;
% time s t e p increment , s
T = n * dt ;
% d u r a t i o n o f t h e time s e r i e s , s
df = 1/ T ;
% f r e q u e n c y increment , Hz
6
7
8
9
10
t =
f =
idx
tau
[
[
=
=
0
0
[
f
: n /2 , -n /2+1 : -1]* dt ;
: n /2 , -n /2+1 : -1]* df ;
n /2+2: n , 1: n /2+1 ];
* dt / df ;
%
%
%
%
time v a l u e s from −T/2+ d t t o T/2
f r e q u e n c y v a l u e s from −1/(2∗ d t ) t o +1/(2∗ d t )
r e s o r t i n g index for p l o t s
time l a g v a l u e s
11
12
13
14
Case = 2 % two c a s e s
% ( 1 ) g i v e n a time s e r i e s [ x ( 1 ) . . . x ( n ) ] e s t i m a t e Sxx ( f )
% ( 2 ) g i v e n a power s p e c t r a l d e n s i t y Sxx ( f ) , s y n t h e s i z e a r e a l i z a t i o n o f [ x ( 1 ) . . . x ( n ) ]
15
16
17
18
i f ( Case == 1 ) % g i v e n a time s e r i e s
. . . f o r example . . .
% a n o i s y two−t o n e s i g n a l
x = s i n (2* pi *6.18* t ) + s i n (2* pi *10.0* t ) + 0.1 * randn(1 , n ) / sqrt ( dt );
19
20
21
22
23
% . . . compute t h e power s p e c t r a l d e n s i t y from t h e time s e r i e s
X = f f t (x) / n;
% complex F o u r i e r c o e f f i c i e n t s from time s e r i e s
Sxx = conj ( X ) .* X / df ;
% power s p e c t r a l d e n s i t y from t h e time s e r i e s
end
% Case 1
24
25
26
27
i f ( Case == 2 ) % g i v e n a power s p e c t r a l d e n s i t y . . . f o r example . . .
% a p o s i t i v e two−s i d e d power s p e c t r a l d e n s i t y , symmetric a b o u t f =0 . . .
Sxx = 1.0 ./ (1.0 + ( f /10).ˆ2 ).ˆ2;
28
29
30
31
32
33
34
35
% . . . s y n t h e s i z e a r e a l i z a t i o n f o r t h e time s e r i e s from t h e power s p e c t r a l d e n s i t y
% random p h a s e a n g l e a t p o s i t i v e f r e q u e n c i e s , u n i f o r m l y −d i s t r i b u t e d b e t w e e n −p i and p i
theta = 2* pi *rand(1 , n /2) - pi ;
theta = [ 0 , theta , - theta ( n /2 -1: -1:1) ]; % p h a s e a n g l e s a n t i −symmetric a b o u t f =0
theta ( n /2+1) = 0;
% f o r r e a l −v a l u e d s i g n a l s
x = r e a l ( i f f t ( sqrt ( Sxx * df ) .* exp( i * theta )))* n ;
% imag p a r t ˜ 1e−16
end % Case 2
36
37
38
% . . . compute t h e auto−c o r r e l a t i o n from t h e power−s p e c t r a l d e n s i t y
Rxx = r e a l ( i f f t ( Sxx )) / dt ;
39
40
41
42
43
44
% . . . compare mean−s q u a r e c a l c u l a t i o n s
. . .
format long
mean_square = sum( x .ˆ2) * dt / T
% mean s q u a r e o f t h e time s e r i e s
mean_square = sum( Sxx ) * df
% mean s q u a r e from t h e power s p e c t r a l d e n s i t y
mean_square = Rxx (1)
% mean s q u a r e from t h e auto−c o r r e l a t i o n
Referring to figures on the next page,
• Case 1: The presence of two sinusoidal components is impossible to discern from the
time series. Two components at 10 Hz and 6.18 Hz are clearly apparent in the power
spectrum.
The spike in RXX (τ ) at τ = 0 is from the added white noise, w.
Two sinusoidal components are apparent seen in RXX (τ ).
• Case 2: The time series contains a broad range of frequency components, with more
spectral power at the low frequencies.
The time series loses correlation at time lags τ greater than 0.1 s.
• The three mean square calculations give the same values in both cases.
CC BY-NC-ND H.P. Gavin
10
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
Case 1 : a noisy two-tone signal
x(t)
x(ti ) = sin(2π(6.18)ti ) + sin(2π(10.0)ti ) + 0.1wi
where wi
is unit Gaussian noise
6
4
2
0
-2
-4
-6
-8
-4
-2
0
2
4
2
Sxx(f)
1.5
1
0.5
0
-20
-15
-10
-5
0
5
10
15
20
-1.5
-1
-0.5
0
0.5
1
1.5
2
4
Rxx(τ)
3
2
1
0
-1
-2
Case 2 : a positive two-sided power spectral density, symmetric about f=0
SXX (f ) = 1/(1 + (f /10)2 )2
15
10
x(t)
5
0
-5
-10
-15
-4
-2
0
2
4
1
Sxx(f)
0.8
0.6
0.4
0.2
0
-20
-15
-10
-5
0
5
10
15
20
-1.5
-1
-0.5
0
0.5
1
1.5
2
20
Rxx(τ)
15
10
5
0
-5
-2
CC BY-NC-ND H.P. Gavin
% re-sorting
% time lag values
tau = f * dt / df;
% psd
Sxx =
% analytic auto-correlation
=
=
=
=
=
=
sum(x_ifft.^2)*dt/T
sum(Sxx)*df
Rxx(1)
sum(x.^2)*dt/T
sum(Sxx_data)*df
Rxx_data(1)
%
%
%
%
%
%
from
from
from
from
from
from
data
**
analytic Sxx **
analytic Rxx **
data
*
Sxx_data
*
Rxx_data
*
% Rxx of data
% Sxx of data
CC BY-NC-ND H.P. Gavin
% ------------------------- example 2
% The Sxx from FFT of x equals generating Sxx
% The Rxx from IFFT of S equals analytic Rxx
figure(2)
clf
subplot(311)
plot(t(idx),x(idx), t(idx),x_ifft(idx),’-.r’)
axis([-20 20])
ylabel(’x(t)’)
legend(’sum cosine’,’ifft’)
subplot(312)
plot(f(idx),Sxx(idx), f(idx),Sxx_data(idx),’-.r’)
axis([-3 3 -0.1 2])
ylabel(’S_{xx}(f)’)
text(-2.5, 0.2,’-f_c’); text( 2.5, 0.2,’+f_c’); text( 0, 1.4,
’S_o’);
legend(’model’, ’data’)
subplot(313)
plot(tau(idx),Rxx(idx),tau(idx),Rxx_data(idx),’-.r’)
axis([-2 2])
set(gca,’xTick’,[-4:4]/Fc);
set(gca,’xTickLabel’,[’-4/f_c’;’-3/f_c’;’-2/f_c’;’-1/f_c’;’0’
;’+1/f_c’;’+2/f_c’;’+3/f_c’;’+4/f_c’]);
ylabel(’R_{xx}(\tau)’)
legend(’model’, ’data’)
if epsPlots, print(’PSD2.eps’,’-color’,’-FHelvetica:10’); end
mean_sq_A
mean_sq_B
mean_sq_C
mean_sq_D
mean_sq_E
mean_sq_F
Rxx_data = real(ifft(Sxx_data))/dt;
conj(X_data).*X_data/df;
% Fourier coeff’s of data
=
=
=
=
=
=
sum(x_ifft.^2)*dt/T
sum(Sxx)*df
Rxx(1)
sum(x.^2)*dt/T
sum(Sxx_data)*df
Rxx_data(1)
%
%
%
%
%
%
from
from
from
from
from
from
data
analytic Sxx
analytic Rxx
data
Sxx_data
Rxx_data
% ------------------------- example 3
% The Sxx from FFT of x equals generating Sxx
% The Rxx from IFFT of S equals analytic Rxx
figure(3)
clf
subplot(311)
plot(t(idx),x(idx), t(idx), x_ifft(idx),’-.r’)
axis([-20 20])
ylabel(’x(t)’)
legend(’sum cosine’,’ifft’)
subplot(312)
plot(f(idx),Sxx(idx), f(idx),Sxx_data(idx),’-.r’)
axis([-3 3 -0.1 2])
ylabel(’S_{xx}(f)’)
text(-Fhi, 0.4,’-f_{hi}’); text( Fhi, 0.4,’+f_{hi}’);
text(-Flo, 0.4,’-f_{lo}’); text( Flo, 0.4,’+f_{lo}’); text( 0
, 1.4,’S_o’);
legend(’model’, ’data’)
subplot(313)
plot(tau(idx),Rxx(idx),tau(idx),Rxx_data(idx),’-.r’)
axis([-2 2])
ylabel(’R_{xx}(\tau)’)
legend(’model’, ’data’)
if epsPlots, print(’PSD3.eps’,’-color’,’-FHelvetica:10’); end
% All six mean_sq calculations are identical!
mean_sq_A
mean_sq_B
mean_sq_C
mean_sq_D
mean_sq_E
mean_sq_F
% Rxx of data
% Sxx of data
% Fourier coeff’s of data
conj(X_data).*X_data/df;
Rxx_data = real(ifft(Sxx_data))/dt;
Sxx_data =
X_data = fft(x)/n;
Sxx_data =
X_data = fft(x)/n;
x_ifft = (ifft(sqrt(Sxx*df) .* exp(i*theta)))*n;
x = zeros(1,n);
% x(t) built up by sums
theta = 2*pi*rand(1,n/2);
% random phase angle
theta = [ 0 , theta , -theta(n/2-1:-1:1) ]; % anti-symm.
theta(n/2+1) = 0;
% for real-valued signals
for k=1:n/2+1
% sum over freq’s >=0 only
x = x + 2*sqrt(Sxx(k)*df)*cos(2*pi*f(k)*t+theta(k));
% Sxx(f=0) = 0, so no need for the "x/2" line.
end
% synthesize a sample of data
Rxx = real(ifft(Sxx))/dt;
imag_over_real = norm(imag(x_ifft))/norm(real(x_ifft))
x_ifft = real(x_ifft);
% All six mean_sq calculations are identical!
% ------------------------- example 1
.... band-pass random noise
Flo = 0.5;
% low cut-off frequency, Hz
Fhi = 2.5;
% high cut-off frequency, Hz
So = 1.25;
% two-sided pass band PSD
Sxx = So*ones(1,n);
Sxx(find(f < -Fhi)) = 0;
Sxx(find(f > Fhi)) = 0;
Sxx(find(-Flo < f & f < Flo)) = 0;
% ------------ example 3
x_ifft = ( ifft(sqrt(Sxx*df) .* ...
(cos(theta) + i*sin(theta))) )*n;
imag_over_real = norm(imag(x_ifft))/norm(real(x_ifft))
x_ifft = real(x_ifft);
x = zeros(1,n);
% x(t) built up by sums
theta = 2*pi*rand(1,n/2);
% random phase angle
theta = [ 0 , theta , -theta(n/2-1:-1:1) ]; % anti-symm.
theta(n/2+1) = 0;
% for real-valued signals
for k=1:n/2+1
% sum over freq’s >=0 only
x = x + 2*sqrt(Sxx(k)*df)*cos(2*pi*f(k)*t+theta(k));
if (k==1) x = x/2; end % first Fourier coeff at f=0;
end
figure(1)
clf
subplot(311)
plot(t(idx),x(idx))
axis([-2 2 -0.1 2.1])
ylabel(’x(t)’)
text(-Tp, 0.2,’-T_p’); text( Tp, 0.2,’+T_p’);
subplot(312)
plot(f(idx),Sxx(idx))
axis([-2 2 -0.005 0.105])
ylabel(’S_{xx}(f)’)
text(-1/Tp, 0.01,’-1/T_p’); text( 1/Tp, 0.01,’+1/T_p’);
subplot(313)
plot(tau(idx),Rxx(idx))
axis([-2 2 -0.005 0.08])
ylabel(’R_{xx}(\tau)’)
text(-Tp, 0.003,’-T_p’); text( Tp, 0.003,’+T_p’);
if epsPlots, print(’PSD1.eps’,’-color’,’-FHelvetica:10’); end
% from x(t)
% from Sxx(f)
% from Rxx(tau)
% analytic auto-correlation
Rxx = real(ifft(Sxx))/dt;
% All three mean_sq calculations are identical!
mean_sq_A = sum(x.^2)*dt/T
mean_sq_B = sum(Sxx)*df
mean_sq_C = Rxx(1)
Rxx = real(ifft(Sxx))/dt;
% auto correlation
% Fourier coeff’s
X = fft(x)/n;
conj(X).*X/df;
% half-pulse period
% "one+cosine"
.... "one+cosine" pulse
Tp = 1;
x = 1+cos(pi*t/Tp);
x(find(t < -Tp)) = 0;
x(find(t > Tp)) = 0;
% -------------- example 1
epsPlots = 0; formatPlot(epsPlots);
format long;
% a lot of significant figures
% freqency axis
% time axis
# of points
time step
total time
frequency step
idx = [n/2+2:n, 1:n/2+1];
= [0:n/2 , -n/2+1:-1] * dt;
%
%
%
%
f = [ 0:n/2 , -n/2+1:-1 ] * df;
t
4096;
0.010;
n*dt;
1/T;
=
=
=
=
n
dt
T
df
% cut-off freqency, Hz
% PSD value in pass-band
% band-limitted noise
% synthesize a sample of data
.... low-pass random noise
Fc = 2.5;
So = 1.25;
Sxx = So*ones(1,n);
Sxx(find(f < -Fc)) = 0;
Sxx(find(f > Fc)) = 0;
1
% ----------- example 2
Fri Nov 20 10:36:13 2015
test computations for
Double-sided auto power spectral density
Auto correlation function
mean square value computed three ways
% note: correct scaling ...
%
% df = 1 / (n*dt)
%
% x = ifft(sqrt(S*df) .* exp(i*theta)) * n
% X = fft(x) / n
% S = conj(X).*X / df
% R = ifft(S) / dt
%
%
%
%
PSD_test.m
Power Spectral Density
11
12
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
2
x(t)
1.5
1
0.5
-Tp
0
-2
-1.5
-1
-2
-1.5
-1
-2
-1.5
-1
+Tp
-0.5
0
0.5
1
-0.5
0
0.5
1
-0.5
0
0.5
1
1.5
2
1.5
2
1.5
2
0.1
Sxx(f)
0.08
0.06
0.04
0.02
-1/Tp
Rxx(τ)
0
0.08
0.07
0.06
0.05
0.04
0.03
0.02
0.01
0
+1/Tp
-Tp
+Tp
10
sum cosine
ifft
x(t)
5
0
-5
-10
-20
-15
-10
-5
0
5
10
15
20
2
Sxx(f)
1.5
model
data
So
1
0.5
-fc
0
+fc
-3
-2
-1
0
1
2
3
8
model
data
Rxx(τ)
6
4
2
0
-2
-4/fc
-3/fc
-2/fc
-1/fc
0
+1/fc
+2/fc
+3/fc
+4/fc
10
sum cosine
ifft
x(t)
5
0
-5
-10
-20
-15
-10
-5
0
5
10
15
2
Sxx(f)
1.5
20
model
data
So
1
0.5
-fhi
-flo
+flo
+fhi
0
-3
-2
-1
0
1
2
3
6
model
data
Rxx(τ)
4
2
0
-2
-4
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
CC BY-NC-ND H.P. Gavin
13
Power Spectral Density
9 Power Spectral Densities for Natural Loads
9.1 Wind Turbulence
9.1.1 Davenport Wind Spectrum
The one-sided power spectral density of horizontal wind velocity, u(t), may be modeled by
the Davenport wind spectrum,
GU U (f ) =
σU2
1
3π
|f L/U10 |2
|f | (1 + |f L/U10 |2 )4/3
with model parameters:
2
= the mean square of the wind turbulence
• σU2 = 6kU10
• k = a dimensionless terrain roughness constant, (0.005 for open country, 0.05 for city)
• U10 = mean wind speed at 10 m elevation
• L = a turbulent length scale characteristic of upper atmosphere air flow
The largest turbulence oscillations f GU U (f ) occur at a frequency of fp =
The one-sided Davenport spectrum is scaled so that σU2 = 2π
R∞
0
√
3 U10 /L.
GU U (f ) df .
Also, define GU U (0) = 0.
9.1.2 Kaimal Wind Spectrum
The one-sided Kaimal spectrum has a power spectral density of
GU U (f ) =
σU2
2
π
(L/U )
(1 + 6|f |(L/U ))5/3
where
• σU = Ti (3U/4 + 5.6), is the turbulence intensity,
• Ti is turbulence parameter (approx 0.2).
• U is the mean wind speed,
• L is the Kaimal length scale, and reflects the size of wind eddies
The one-sided Kaimal spectrum is scaled so that σU2 = 2π
R∞
0
GU U (f ) df .
Referring to plots of the spectra on the next page, the Davenport length scale is about an
order of magnitude larger than the Kaimal length scale for comparable spectra. At these
length scales, most of variability in wind occurs at frequencies that are a bit lower than the
natural frequencies of structural systems (0.5 Hz to 5 Hz).
CC BY-NC-ND H.P. Gavin
14
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
wind turbulence power spectrum, f Guu(f) / σ2u
0.06
U= 5 m/s, σU= 1.2m/s
U=10 m/s, σU= 2.4m/s
U=20 m/s, σU= 4.9m/s
U=50 m/s, σU= 12.2m/s
0.05
0.04
0.03
0.02
0.01
0
10-3
10-2
10-1
100
turbulence frequency, Hz
101
102
Figure 1. Davenport wind turbulence spectra with a Davenport length scale of L = 500 m.
0.04
U= 5 m/s, σU= 3.2m/s
U=10 m/s, σU= 4.5m/s
U=20 m/s, σU= 6.4m/s
U=50 m/s, σU= 10.1m/s
wind turbulence power spectrum, f Guu(f) / σ2u
0.035
0.03
0.025
0.02
0.015
0.01
0.005
0
-3
10
10
-2
-1
0
10
10
turbulence frequency, Hz
10
1
10
2
Figure 2. Kaimal wind turbulence spectra with a Kaimal length scale of L = 50 m.
CC BY-NC-ND H.P. Gavin
15
Power Spectral Density
9.2 Ocean Waves
9.2.1 Pierson-Moskowitz Spectrum
In a fully-developed sea with a uni-directional wave-field, the one-sided power spectral density
of wave-height z(t) can be modeled by the Pierson-Moskowitz spectrum,

4 
αg 2
5 f − p 
GZZ (f ) =
exp
|2πf |5
4f with model parameters:
•
•
•
•
α = a dimensionless constant, 0.0081 for the North Atlantic
g = gravitational acceleration (9.81 m/s2 )
fp = g/[(1.14)(2π)U19.5 ] is the frequency of the largest waves (Hz)
U19.5 = mean wind speed at 19.5 m above mean sea level (U19.5 ≈ (1.026)U10 ) (m/s)
and define GZZ (0) = 0. The mean-square value of the wave heights is
4
α U19.5
g 2 2.96
0
So the standard deviation of the wave height is proportional to the mean wind speed squared,
which is a strong-dependence on mean wind speed. The speed of the largest waves is
g
≈ (1.14)U19.5
cp =
2πfp
D
2
E
Z (t) =
σZ2
= 2π
Z ∞
GZZ (f ) df ≈
The speed of the largest waves is 14% faster than the mean wind speed.
9.2.2 JONSWAP Spectrum
The Pierson-Moskowitz spectrum is a special case of the JONSWAP spectrum. The JONSWAP spectrum models developing seas and accounts for the distance from the shoreline
(the “fetch”, F ). through an additional factor, γ δ(f ) .

4 
5 f αg 2
− p  γ δ(f )
GZZ (f ) =
exp
|2πf |5
4f where GZZ (0) = 0; γ is a magnification factor for the largest waves (γ ≈ 3.3) and the
exponent δ depends on frequency,
"
#
(1 − |f /fp |)2
,
δ(f ) = exp −
2(σ(f ))2
and where
•
•
•
•
0.22
2
α = 0.066 (U10
/(gF ))
γ is the magnification of the largest waves . . . 1 < γ < 7 . . . on average γ ≈ 3.3.
fp = 2.84(g 2 /(U10 F ))0.33 is the frequency of the largest waves
σ(f ) = 0.07 for |f | ≤ fp , and σ(f ) = 0.09 for |f | > fp
CC BY-NC-ND H.P. Gavin
16
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
4
U= 9 m/s, σZ=0.43m
U=10 m/s, σZ=0.53m
U=12 m/s, σZ=0.77m
U=15 m/s, σZ=1.20m
wave height power spectrum, Gzz(f), m2/Hz
3.5
3
2.5
2
1.5
1
0.5
0
0
5
10
wave period, s
15
20
Figure 3. Pierson-Moskowitz spectra for fully-developed seas.
5
U= 9 m/s, σZ=0.64m
U=10 m/s, σZ=0.70m
U=12 m/s, σZ=0.82m
U=15 m/s, σZ=1.00m
4
wave height power spectrum, Gzz(f), m2/Hz
3
2
1
0
0
12
10
8
6
4
2
0
5
10
15
20
10
15
20
10
wave period, s
15
20
U= 9 m/s, σZ=0.93m
U=10 m/s, σZ=1.02m
U=12 m/s, σZ=1.20m
U=15 m/s, σZ=1.46m
0
50
5
U= 9 m/s, σZ=1.54m
U=10 m/s, σZ=1.69m
U=12 m/s, σZ=1.99m
U=15 m/s, σZ=2.41m
40
30
20
10
0
0
5
Figure 4. JONSWAP spectra with γ = 3.3 and F = 100 km, 200 km, and 500 km.
CC BY-NC-ND H.P. Gavin
17
Power Spectral Density
9.3 Earthquake Ground Motions
A one-sided power spectral density for ground accelerations
GAA (f ) = ā2
2
π
(2ζg f /fg )2
(1 − (f /fg )2 )2 + (2ζg f /fg )2
is parameterized by:
• fg , a ground motion frequency (Hz) and
• ζg , a ground motion damping ratio.
This spectrum corresponds to a linear time-invariant system with a realization
"
A B
C D
#


0
1
0


2 2
ā
−4π
f
−4πζ
f
∼

g g
g
0
4πζg fg 0
The mean-square value of the ground accelerations is
D
2
E
A (t) =
σA2
= 2π
Z ∞
0
GAA (f ) df = ā2
5 2
π fg zg
4
However, unlike the models for wind turbulence and ocean waves described in the previous
sections, earthquake ground motions have time-varying amplitudes. An envelope function
that mimics the growth and decay of earthquake ground motions is
e(t) = (ab)−a ta exp(a − t/b)
which has a maximum of e = 1 at t = ab.
The spectral and temporal characteristics of earthquake ground motion are influenced by
many factors, primarily the magnitude of the rupture, the distance to the fault, the depth
of the rupture, and the local soil conditions. Strong ground motions at sites far from a fault
tend to have higher frequency content and longer duration. Ground motions at sites close to
a fault can have a large amplitude pulse, depending on the directivity of the fault rupture in
relation to the site and other factors.
Relevant models for earthquake ground motions generate the kinds of structural responses
excited by real (recorded) ground motions. For this reason, the model parameters ā, fg , ζg ,
a, and b are adjusted so that, on average, the mean response spectra of the synthetic ground
motions match the response spectra from representative sets of earthquake ground motions.
This fitting was carried out with three suites of recorded ground motions for the ATC-63
project on structural collapse, with the resulting response spectra and model parameters
shown below.
CC BY-NC-ND H.P. Gavin
18
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
1.2
1
0.8
0.6
0.4
0.2
0
1
10
natural period, Tn, s
10
Model: mean and mean+std.dev.
Data: mean and mean+std.dev.
1.4
(b) Near-Fault without Pulse
1.2
1
0.8
0.6
0.4
0.2
0
10-1
0
1
10
natural period, Tn, s
10
Table 1. Ground motion parameters fit to the ATC-63 ground
P GV fg zg
a
FF
0.33 1.5 0.9 4.0
NF-NP 0.52 1.3 1.1 3.0
NF-P
0.80 0.5 1.8 1.0
m/s Hz
-
spectral acceleration, Sa(Tn), g
(a) Far-Field
0
10-1
1.6
1.6
Model: mean and mean+std.dev.
Data: mean and mean+std.dev.
1.4
spectral acceleration, Sa(Tn), g
spectral acceleration, Sa(Tn), g
1.6
Model: mean and mean+std.dev.
Data: mean and mean+std.dev.
1.4
(c) Near-Fault with Pulse
1.2
1
0.8
0.6
0.4
0.2
0
10-1
100
natural period, Tn, s
101
motion suites.
b
ā
2.0 0.23
2.0 0.33
2.0 0.43
s m/s2
ground acceleration power spectrum, Gaa(f)
Either of the two amplitude constants P GV (peak ground velocity) or ā may be used to
specify the amplitude of the ground motion. If P GV is used the ground motion is scaled to
the specified peak value.
0.12
far-field
near-fault without pulse
near-fault with pulse
0.1
0.08
0.06
0.04
0.02
0
0
2
0
5
4
6
ground motion frequency, Hz
8
10
20
25
1
envelope
0.8
0.6
0.4
0.2
0
10
15
time, s
Figure 5. Spectra and envelopes for three classes of earthquake ground motions.
Synthesized ground motion accelerations may be detrended so that the ground velocity is
zero and the ground displacement is nearly zero at the end of the synthesized ground motion,
as illustrated by the example realizations on the next page.
CC BY-NC-ND H.P. Gavin
19
Power Spectral Density
displ. cm
veloc. cm/s
accel. g
displ. cm
veloc. cm/s
accel. g
displ. cm
veloc. cm/s
accel. g
0.2
0.1
0
-0.1
-0.2
0
5
10
15
20
25
30
0
5
10
15
20
25
30
0
5
10
15
20
25
30
0
5
10
15
20
25
30
0
5
10
15
20
25
30
0
5
10
15
20
25
30
0
5
10
15
20
25
30
0
5
10
15
20
25
30
0
5
10
15
20
25
30
20
10
0
-10
-20
-30
25
20
15
10
5
0
0.4
0.3
0.2
0.1
0
-0.1
-0.2
-0.3
-0.4
50
40
30
20
10
0
-10
-20
-30
10
5
0
-5
-10
0.3
0.2
0.1
0
-0.1
-0.2
-0.3
60
40
20
0
-20
-40
-60
-80
60
40
20
0
-20
-40
CC BY-NC-ND H.P. Gavin
20
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
10 Finite-time discrete unit Gaussean white noise
A finite-length time series of unit Gaussean white noise is a series of samples from a set of n
independent identically-distributed (iid) Gaussean random variables,
u=
h
u0 u1 u2 · · ·
up · · ·
un−1
i
with zero mean and a variance of 1/(∆t), where (∆t) is the sampling interval.
15
15
time series, u
σ2
u = 1/dt = 1/0.05
10
10
5
5
0
0
-5
-5
-10
-10
-15
-15
0
20
40
60
80
100
0 0.010.020.030.040.050.060.070.080.09
time, s
p.d.f.
Figure 6. Gaussean unit white noise with (∆t) = 0.05 s,pn = 2048; computed with
u=randn(1,n)/sqrt(dt); T = (n)(∆t) = 102.4 s and σu =
sample, line: Normal distribution
1/(∆t). points: histogram of
The complex Fourier coefficients Ūq for this series can be computed with a discrete Fourier
transform,
X
1 n−1
2πqp
up exp −i
n p=0
n
Ūq =
, q=
h
− n2 + 1, − n2 + 2, · · · , −1, 0, 1, · · · .
n
2
i
where up is (p + 1)st element of the sequence of uncorrelated standard Gaussean random
variables. So, Ūq is a weighted sum of Gaussean random variables, where the weights
e−i2πqp/n = cos(2πqp/n) + i sin(2πqp/n)
are complex-valued. The frequency increment (∆f ) equals 1/T , and the Nyquist frequency
range is −1/(2∆t) < f ≤ 1/(2∆t).
CC BY-NC-ND H.P. Gavin
21
Power Spectral Density
If the input to a dynamical system is discrete unit Gaussean white noise, then the power
spectral density of the output of the system is equal to the magnitude-squared of the system
frequency response function. This is a common application of Gaussean white noise in the
context of dynamic systems analysis. It is therefore helpful to understand the statistical
properties of unit Gaussean white noise.
Finite time discrete unit Gaussean white noise has the following provable properties:
• The real parts of the Fourier coefficients Ūq are symmetric about q = 0 (even); the odd
parts of Ūq are anti-symmetric about q = 0 (odd). Both the real and imaginary parts
of Ūq have zero mean, and a variance of 1/(2T ) (figure 7).
• The real and imaginary parts of Uq are uncorrelated (figure 8).
q
• The Fourier magnitudes, |Ūq |, have a Rayleigh distribution with paramter σ = 1/(2T )
and the Fourier phase, arctan(I(Ūq )/R(Ūq )), is uniformly distributed in [−π : π] (figure 9).
• The auto-power spectral density of sampled unit white noise has an expected value of 1
over the Nyquist frequency range. The auto-power spectral density is a χ2 -distributed
random variable with a degree-of-freedom (d.o.f.) of 2, and a variance of 1. The
coefficient of variation of the power spectral density of unit Gaussean white noise is
therefore also 1 (figure 10).
• The autocorrelation R(τ ) of sampled unit white noise resembles δ(τ ) with R(0) = σu2 =
1/(∆t) (figure 11).
• The fact that the power spectral density estimate from a sample of Gaussean white
noise has a coefficient of variation of 1 means that the uncertainty in the PSD estimate
is as large as the mean PSD value. This presents a challenge in the estimation of
PSD’s from noisy data. This coefficient of variation can be reduced by averaging PSD’s
together.
The average of K PSD’s of independent samples of unit Gaussean white noise is a
χ2 -distributed random variable
q with 2K degrees of freedom, a covariance of 1/K and
a coefficient of variation of 1/K (figure 12).
Note that the generation of a random time series from a given power spectral density function
(as in example 2 of section 8) results in a time series with exactly the prescribed power spectral
density. If the generated time series is meant to represent a random phenomenon, then it
would be appropriate to randomize the Fourier amplitudes with a Rayleigh distribution.
The reduction of the variance of PSD estimates with averaging motivates the Welch method
for estimating power spectral densities from measurements of noisy time series.
CC BY-NC-ND H.P. Gavin
22
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
11 Estimating power spectral density from noisy data - psd.m
The previous section, and Figures 6 and 12 show that averaging the magnitude-square of the
Fourier amplitudes computed from several independent realizations of the same (stationary)
random process reduces the variance of the power spectral density estimate.
Fourier analysis of any finite-duration time series fundamentally presumes that the series
repeats periodically. If the series is representative of a discrete-time random process then a
sequence of n points from the process does not repeat itself periodically. That of a sequence
of n points is sampled from a random process, xk 6= xk+n ∀k, 1 ≤ k ≤ n. If the process is
band-limitted, the spectral density approaches zero as the frequency approaches the Nyquist
frequency. However, the periodic extension of an n-point segment of a band-limited process
will have a sharp discontinuity between xn and xn+1 . The Fourier components of sequences
with sharp discontinuities do not approach zero as the frequency approaches the Nyquist
frequency. In fact, these high-frequency spectral magnitudes can be quite a bit larger than
those of the true band limitted process.
In Welch’s method for estimating the power spectral density from a band-limited sequence,
CC BY-NC-ND H.P. Gavin
23
Power Spectral Density
12 Estimating frequency response functions from noisy data - tfe.m
CC BY-NC-ND H.P. Gavin
24
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
complex Fourier coefficients, U
0.4
0.4
real(U) ... even
imag(U) ... odd
0.3
0.3
0.2
0.2
0.1
0.1
0
0
-0.1
-0.1
-0.2
-0.2
-0.3
-0.3
-0.4
-10
2
σU = 1/(2T)
-0.4
-5
0
5
frequency, f, Hz
10
0
1
2
3
4
p.d.f.
5
6
7
Figure 7. Fourier transform coefficients of the sample of Gaussean unit white noise shown in
figure 6. computed with U=fft(u)/n; points: histogram of sample, line: Normal distribution
correlation between real and imaginary = -0.000
0.2
imag(U) (odd)
0.1
0
-0.1
-0.2
-0.2
-0.1
0
real(U) (even)
0.1
0.2
Figure 8. The real and imaginary parts of Uq are uncorrelated.
CC BY-NC-ND H.P. Gavin
25
Fourier phase, <U/π (odd)
Fourier amplitude, |U| (even)
Power Spectral Density
0.35
0.35
0.3
0.3
0.25
0.25
0.2
0.2
0.15
0.15
0.1
0.1
0.05
0.05
0
-10
σ2 = 1/(2T)
0
-5
0
5
10
0
1
1
0.5
0.5
0
0
-0.5
-0.5
-1
-10
Rayleigh distribution
2
4
6
8
10
12
-1
-5
0
5
frequency, f, Hz
10
0
0.05 0.1 0.15 0.2 0.25 0.3
p.d.f
Figure 9. Fourier transform magnitudes and phases of the sample of Gaussean unit white noise
shown in figure 6, The magnitudes are symmetric about f = 0 (even); the phases are antisymmetric about f = 0 (odd). points: histogram of sample, line: Rayleigh distribution for |U |
and uniform distribution for ∠U
CC BY-NC-ND H.P. Gavin
26
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
K=1, coefficient of variation of S = 0.996
8
7
7
power spectral density, S
6
5
6
χ2 distribution
5
d.o.f. = 2
4
4
3
3
2
2
1
1
0
0
-10
-5
0
5
frequency, f, Hz
10
0
0.2
0.4
0.6
p.d.f.
0.8
1
Figure 10. Power spectral density of the sample of unit Gaussean noise shown in figure 6.
computed with S=conj(U)*U/(df) Dashed lines show the 50% confidence interval for the
power spectral density. left: points = histogram of the PSD data, line = χ2 distribution
CC BY-NC-ND H.P. Gavin
27
Power Spectral Density
25
20
autocorrelation, R(τ)
15
10
5
0
-5
-60
-40
-20
0
time lag, τ, s
20
40
60
Figure 11. Autocorrelation function of the sample of unit Gaussean noise shown in figure 6.
computed with R=ifft(S)/df
CC BY-NC-ND H.P. Gavin
28
CEE 541. Structural Dynamics – Duke University – Fall 2016 – H.P. Gavin
K=10, coefficient of variation of S = 0.307
3
2.5
2.5
2
2
power spectral density, S
χ distribution
2
d.o.f. = 2K
1.5
1.5
1
1
0.5
0.5
0
0
-10
-5
0
5
frequency, f, Hz
10
0 0.050.10.150.20.250.30.350.40.450.5
p.d.f.
Figure 12. Average of power spectral densities from K = 10 independent samples of unit
Gaussean white noise. Dashed lines show the 50% confidence interval for the power spectral
density. left: points = histogram of the PSD data, line = χ2 distribution with 2K degrees of
freedom.
CC BY-NC-ND H.P. Gavin
Download