Professional Documents
Culture Documents
Orthogonal Functions
Fourier Series
cos(ft)
0.3cos(2ft)
sum: cos(ft)+0.3cos(2ft)
exactly periodic,
but shape not
exactly sinusoidal
error of fit, e
linear term, bt
So LGA is warming
f1 = 1 / (2Nt)
f1 = 1 / (2t)
Count of unknowns
The constant term, one unknown
plus
2 coefficients per frequency, N/2 frequencies so N unknowns
minus
One unknown since the fN/2 term, which has no sine term
equals
N unknowns, same as number of data
MatLab Code
N = 100;
dt = 0.5;
tmin = 0.0;
t = tmin + dt*[0:N-1]';
tmax = tmin + dt*(N-1);
% times vector
df = 1/(N*dt);
M = N;
% frequency spacing
% number of unknowns same as data
G = zeros(N,M);
G(:,1)=ones(N,1);
for p = 2*[1:M/2-1]
G(:,p) = cos(pi*p*df*t);
G(:,p+1) = sin(pi*p*df*t);
end
p=M/2;
G(:,M) = cos(2*pi*p*df*t);
So least-squares solution is
m = [GTG]-1 GTd =
= diag( N-1, 2/N, 2/N, N-1 ) GT d
NO matrix inversion required!
spectrum
amount of power at different
frequencies
si2 = Ai2 + Bi2
s i2
time-series has
a lot of
energy at
frequency fp
fi
fp
2 mo
3 mo
4 mo
6 mo
12 mo
Big annual
cycle in Neuse
hydrograph
But first
Lets switch to angular frequency
measured in radians per second
i = 2 fi
Beats writing all those 2s !
Remember
Eulers formula
exp( it ) = cos( t ) + i sin( t )
?
=1
Lets compare
=0
with p=p
p= -p
T(t) = A0 cos(0t) + B0 sin(0t) +
A1 cos(1t) + B1 sin(1t) +
A2 cos(2t) + B2 sin(First,
2t) +if T is real, then we must have C-p = Cp*
A3 cos(3t) + B3 sin(Then
exp(-pt) + Cp exp(pt) =
3t) +C-p
with
T(t) = ... +
C-2 exp(-i2t) +
C-1 exp(-1t) +
C0 exp(i0t) +
T(t) = ... +
C-2 exp(-i2t) +
C-1 exp(-1t) +
C0 exp(i0t) +
C1 exp(i1t) +
C2 exp(i2t) +
C3 exp(i3t) +
T0
T1
T2
T3
T4
exp(-i2t0)
exp(-i2t1)
exp(-i2t2)
exp(-i2t3)
exp(-i1t0)
exp(-i1t1)
exp(-i1t2)
exp(-i1t3)
exp(i0t0)
exp(i0t1)
exp(i0t2)
exp(i0t3)
exp( i1t0)
exp( i1t1)
exp( i1t2)
exp( i1t3)
exp(i2t0)
exp( i2t1)
exp( i2t2)
exp( i2t3)
C-2
C-1
C0
C1
C2
complex nos:
given Gm =d
minimize E=eTe
implies m=[GTG]-1 GT d
The Hermitian
transpose, that is, the
transpose of the
complex conjugate.
given Gm =d
minimize E=eHe
where eH = e*T
implies m=[GHG]-1 GH d
The formula m=[GHG]-1GHd is not hard to work out using the standard
minimization procedure, but we dont have time to work it out in class.
T0
T1
T2
T3
T4
d=Gm
=
exp(-i2t0)
exp(-i2t1)
exp(-i2t2)
exp(-i2t3)
exp(-i1t0)
exp(-i1t1)
exp(-i1t2)
exp(-i1t3)
exp(i0t0) exp(i1t0)
exp(i0t1) exp(i1t1)
exp(i0t2) exp(i1t2)
exp(i0t3) exp(i1t3)
exp(i2t0)
exp(i2t1)
exp(i2t2)
exp(i2t3)
Note T2 i Ci exp(+it2)
C-2
C-1
C0
C1
C2
m=N-1GHm
exp(i2t0) exp(i2t1) exp(i2t2)
exp(i1t0) exp(i1t1) exp(i1t2)
=N-1 exp(i0t0) exp(i0t1) exp(i0t2)
exp(-i1t0) exp(-i1t1) exp(-i1t2)
exp(i2t3) exp(i2t4)
exp(i1t3) exp(i1t4)
exp(i0t3) exp(i0t4)
exp(-i1t3) exp(-i1t4)
Note C2 i Ti exp(-iti)
C-2
C-1
C0
C1
C2
T0
T1
T2
T3
T4
T0
T1
T2
T3
T4
d=Gm
=
exp(-i2t0)
exp(-i2t1)
exp(-i2t2)
exp(-i2t3)
exp(-i1t0)
exp(-i1t1)
exp(-i1t2)
exp(-i1t3)
exp(i0t0) exp(i1t0)
exp(i0t1) exp(i1t1)
exp(i0t2) exp(i1t2)
exp(i0t3) exp(i1t3)
exp(i2t0)
exp(i2t1)
exp(i2t2)
exp(i2t3)
Note T2 i Ci exp(+it2)
C-2
C-1
C0
C1
C2
M=N-1GHm
exp(i2t0) exp(i2t1) exp(i2t2)
exp(i1t0) exp(i1t1) exp(i1t2)
=N-1 exp(i0t0) exp(i0t1) exp(i0t2)
exp(-i1t0) exp(-i1t1) exp(-i1t2)
Opposite
signs
exp(i2t3) exp(i2t4)
exp(i1t3) exp(i1t4)
exp(i0t3) exp(i0t4)
exp(-i1t3) exp(-i1t4)
Note C2 i Ti exp(-iti)
C-2
C-1
C0
C1
C2
T0
T1
T2
T3
T4
-1
-1
Counting unknowns
frequencies from (N/2) to (N/2)in steps of
So N+1 complex numbers, Cp
So 2N+2 real and imaginary parts, C pr and Cpi
But C-p = Cp*, so really only N/2+1 unknown complex
numbers
So N+2 real and imaginary parts , Cpr and Cpi (p0)
But C0i=0 and CN/2i=0 (always)
So N unknowns, matching N data