Professional Documents
Culture Documents
Waves - Spectra Noise & Correlations - Lecture
Waves - Spectra Noise & Correlations - Lecture
Waves - Spectra Noise & Correlations - Lecture
W. Gekelman
Lecture 1, December 6,2003
All signals (sound, light, waves, mathematical functions) can be broken down into
Fundamental building blocks. These are called the elements of the spectra:
! !
∂ E 1 ∂ E
2 2 The light is moving in the z direction at speed c
= 2 2 C = 186,000 mi/sec=3X108 meter/s
∂z 2
c ∂t E is the electric field of the wave
z t z t
E = A sin 2π − + cos 2π −
λ T λ T
a=1
a=3
k=0 k=3
k=30
k=6
We can add sines and cosines up. Adding them is just like writing z= a+b
y = sinx+sin4x
y = sin2x+cosx
y=sin2x-cosx
k=0 y1 = sin(πx)
k =1 ; y = y1 + sin(2πx)/3
k = 3 ; y = y1 +y2+ sin(7πx)/7
Lets sum up 50 terms!
∞ ∞
F(z) = B0 + ∑ Am sin(mkz ) + ∑ Bm cos( mkz)
m =1 m =1
This is a function of z which a position like x or y. You can also have a series
which describes a function F(t), function of time. The mathematics doesn’t care!
This spiral is a function you cant use This is Pascal’s snail. No Fourier
Fourier Series to describe series here either!
There are many other kinds of series, the ones we just showed are called
Taylor series or power series. You can also construct series out of sines and
cosines:
y
What this “integral” means is for every position z within one wavelength take the
function F(z) , which could be an experimental measurement, multiply by the
sine:
sin(mkz)= sin(2πmz/λ)
Then go to the next z (which is a very small distance away), multiply by the next
sine and add it to the first. This is the same as adding an infinite number of
terms together.
z+ λ
The integral is really infinite sum 2
Am =
λ ∫ F(z)sin(mkz)dz
For example z
2
Am = F ( z0 ) sin(mkz0) + F ( z1) sin(mkz1) + F( z2 ) sin(mkz2) +.......F( zn ) sin(mkzn )
λ
where z1 − z0 = ε and ε →0
∫
x =0
3dx = 3x |50 = 3(5) − 3(0) = 15
y=3
dx
The integral means take a dx (which is very) , multiply by the value of y above the
Dx, shift your dx and keep on doing it until you hit the limit for x.
f(x)= .75x
i.e. formula for
the line is y=x
4
3 x2 4 3 16 1 1
∫0 .75xdx = 4 ( 2 |0 ) = 4 ( 2 − 0) = 6 Area= 2 (base × height ) = 2 ( 4 × 3) = 6
The Fourier series for a function which changes in time is :
∞
2π
x ( t ) = a0 + ∑ ( an cos nωt + bn sin nωt ) ω =2π f =
n =1 T
2 T
a n = ∫ x ( t ) cos nωtdt n = 0,1,2,3...
T 0
2 T
b n = ∫ x ( t ) sin nωtdt n =1,2,3...
T 0
∞
x ( t ) = a0 + ∑ X n cos( nωt + θ n ) θ n is the phase of each term
n =1
bn
where X n = a + b 2
n
2
n θ n = tan n=1,2,3...
−1
an
Now lets introduce the concept of spectra
WE know that any time series (such as our data) can be
represented by a series:
∞
x ( t ) = a0 + ∑ ( an cos nωt + bn sin nωt ) ω =2π f
n =1
The spectra of x(t) tells us how much of each frequency is present in the
signal. Suppose the signal is composed of one sine wave only :
x(t) = 3sin(2πf1t)
f1
Suppose the signal is composed of two sine waves :
x(t) = 3sin(2πf1t)+sin(2πf2t) ; where f2 = 3 f1
x(f)
f1 f2
x(t)
x(f)
f
Lecture notes on Waves/Spectra
Noise, Correlations and ….
W. Gekelman
Lecture 2, January 17,2004
From the first lecture we discovered that any periodic mathematical function can be
expressed as an infinite power series, a Fourier series:
∞
2π
x ( t ) = a0 + ∑ ( an cos nωt + bn sin nωt ) ω =2π f =
n =1 T
2 T
a n = ∫ x ( t ) cos nωtdt n = 0,1,2,3...
T 0
2 T
b n = ∫ x ( t ) sin nωtdt n =1,2,3...
T 0
Each an or bn tells us “how much power” is in the nth frequency. Therefore each
an or bn is a term in the spectrum.
Here the spectrum is continuous so there
Power are an infinite number of a’s and b’s in the
Fourier series!
Frequency
(color for light, pitch for sound)
Questions for today:
1) How do we find all the a’s and b’s from our data? (In other words how do
we actually do a Fourier transform?)
2) What is phase?
3) What does phase have to do with Fourier Transforms ?
4) What is an inverse Fourier Transform?
5) Are there any pitfalls in using digitally acquired data?
6) Once we have a spectra are we all done or is there something else?
Some noise is truly random and is not made up of waves
V(t)
t (time)
f (frequency)
1. How can we tell is what we have is random noise or if it is made out of waves?
2. If the noise is not random what is it made out of?
3. If our data has random noise in it and a valuable signal as well, how do we
separate the signal from the noise?
4. What is the importance of the frequency spectrum?
5. How do we get the spectrum from x(t) ?
6. Is the spectrum enough to tell us about what the noise is composed of?
7. What are the techniques of extracting a valuable signal from an enormous
background of noise (where the noise is a million times larger than the signal)?
8. How do you do all of these when your data is digital? Digital data is collected at
discrete time steps (example one sample per microsecond). It is not continuous
in time
These are complicated issues. Lets first concern ourselves with a signal that
looks like random noise but is actually made up of many waves.
Complex Numbers
This is all due to a famous identity due to DeMoivre:
e = cos θ + i sin θ
iθ
where i = -1
e is a transcendental number like π
e = 2.7182818284590452…. Or by an infinite series:
1 1 1 1 1 1 1
e = 1+ + + + + + + , with = = 1/ 6
1! 2! 3! 4! n! 3! 3 • 2i1
Properties of e:
eaeb=ea+b ea/eb=ea-b (ea)b = eab
multiplication and division become addition and subtraction !
Graph of y = lnx
x
So lets reiterate now that we know what e is:
e = cos θ + i sin θ
iθ
where i = -1
e is related to sines and cosines as well as logs. Since sines and
cosines are solutions to the wave equation so is e!
Re z example: z=1+i
Review :A complex number z=x+iy=Aeiθ = Α(cosθ+isinθ)
These are all equivalent representations. What do they look
like?
iy Example
z= Im(eix)
z= Im(cosx+isinx)=sinx
iy
When t=0 x=1, y=0, (cosθ =1, sinθ = 0) ,When t =0.5 x= -1, y =0 ,
When t = 0.1 cos(.2θ)= 0.809, sin(.2θ) = 0.588 ; (.809)2+(.588)2 = 1
How do you multiply two complex numbers?
Normally if a and b and real numbers then ab=ba if a = b then you get b2
ž is a complex number then z2 = ž ž* = (x+iy)(x-iy) = x2+y2+ixy-ixy=x2+y2
( x + iy )( x − iy ) = e2π iz e −2π iz = 1
x 2 + y 2 + ixy − ixy = x 2 + y 2 = 1 for any value of z
x + iy = e 2π iz = cos ( 2π z ) + i sin ( 2π z )
Equate the real and imaginary parts (they are two seperate axis)
x = cos ( 2π z ) y= sin ( 2π z )
Lecture notes on Waves/Spectra
Noise, Correlations and ….
W. Gekelman
Lecture 3, January 31,2004
From the first lecture we discovered that any periodic mathematical function can be
expressed as an infinite power series, a Fourier series:
∞
2π
x ( t ) = a0 + ∑ ( an cos nωt + bn sin nωt ) ω =2π f =
n =1 T
2 T
a n = ∫ x ( t ) cos nωtdt n = 0,1,2,3...
T 0
2 T
b n = ∫ x ( t ) sin nωtdt n =1,2,3...
T 0
Each an or bn tells us “how much power” is in the nth frequency. Therefore each
an or bn is a term in the spectrum.
So lets reiterate now that we know what e is:
e = cos θ + i sin θ
iθ
where i = -1
e is related to sines and cosines as well as logs. Since sines and
cosines are solutions to the wave equation so is e!
iy Example
z= Im(eix)
z= Im(cosx+isinx)=sinx
iy
When t=0 x=1, y=0, (cosθ =1, sinθ = 0) ,When t =0.5 x= -1, y =0 ,
When t = 0.1 cos(.2θ)= 0.809, sin(.2θ) = 0.588 ; (.809)2+(.588)2 = 1
It’s a spiral (in the picture the x and y
axis have the arrows)
So here’s what we are going to do:
Amplifier
Detector
Suppose you have N time samples in your data (the digitizer can store
1024 numbers). Suppose the digitizer takes data every microsecond (dt =
1µs).
The total length in time of your record is T=Ndt = 1024*10-6 =1.024X10-3
sec = 1.023 ms. ≈ 1 ms.
This is called Tp or the Nyquist frequency
What is the lowest frequency you can measure in your data?
Answer flow = 1/(2dt) = 1/2X10-3 = 5X102 sec = 500 Hz
2 T
a n = ∫ x ( t ) cos nωtdt n = 0,1,2,3...
T 0
2 T
b n = ∫ x ( t ) sin nωtdt n =1,2,3...
T 0
But since time is not continuous after we digitize t=m∆t, ∆t are the timesteps we
digitize at:
N
2
cos nωm sin nωm
x m ≡ x ( m∆t ) = a0 + ∑ an + bn ω =2π f
m =1 N N
Note the time has been replaced by m/N and the limit does not go to infinity but to
N/2 (the longest period we can measure due to the Nyquist limit!).
The weights an and bn are also discrete and the formulas:
2 T
a n = ∫ x ( t ) cos nωtdt n = 0,1,2,3...
T 0
2 T
b n = ∫ x ( t ) sin nωtdt n =1,2,3...
T 0
Become: 2 N
nωm
an =
N
∑ xm cos
m =1 N
2 N
nωm
bn =
N
∑
m =1
xm sin
N
N
1
a0 =
N
∑x
m =1
m =< x >= 0
For a0 we assume that the signals are made of waves and the average value for
all waves is zero (<x> is the average value of x)
How many mathematical operations does it take to find all
the a’s and b’s ???. We have collected N time steps of data
How this is implemented is complicated and you may learn it one day in an
advanced math course in college but the bottom line is the FFT requires
number of operations = N/2p for data sets where the number of time
steps is a power of 2 namely N=2p.
Since 210 = 1024 , number of operations = 1024/(2*10)=52
Many math packages do FFT’s including PVwave. When you do an FFT of one of
your signals what do you get back?
Suppose I go into the lab and digitize a signal of B(t) where B is one
component of the magnetic field. B(t) is due to waves. B(t) has 5001 time
steps. The data looks like:
The PVwave command to do the FFT is > bfft=fft(B,-1)
When you do this what do you get?
This does not look like a spectrum at all. Also it looks like the result is mirrored
about the point in the center. What is going on ?
Lecture notes on Waves/Spectra
Noise, Correlations and ….
W. Gekelman
Lecture 4, February 28, 2004
Our digital data is a function of time x(t) and can be represented as:
∞
x ( t ) = a0 + ∑ ( an cos nωt + bn sin nωt ) ω =2π f
n =1
2 T
a n = ∫ x ( t ) cos nωtdt n = 0,1,2,3...
T 0
2 T
b n = ∫ x ( t ) sin nωtdt n =1,2,3...
T 0
But since time is not continuous after we digitize t=m∆t, ∆t are the timesteps we
digitize at:
N
2
cos nωm sin nωm
x m ≡ x ( m∆t ) = a0 + ∑ an + bn ω =2π f
m =1 N N
Note the time has been replaced by m/N and the limit does not go to infinity but to
N/2 (the longest period we can measure due to the Nyquist limit!).
Prescription
• We will use infinite series to represent all mathematical functions
(note your data is a function x(t), you just happen to measure it! )
• Instead of saying that the series are sums of sines and cosines we
will represent them as series of Ansin(2πnt+Φn)
• Sometimes instead of using Ansin(2πnt+Φn)
we can use complex numbers and write each term as
xn(t) = Anei(2πnt+Φn)
Note xn(t) is the nth sine term in the time series , not the nth time
step!!!!
2 T
a n = ∫ x ( t ) cos nωtdt n = 0,1,2,3...
T 0 This requires n2
2 T
b n = ∫ x ( t ) sin nωtdt n =1,2,3... operations!
T 0
Become: 2 N
nωm
an =
N
∑ xm cos
m =1 N
2 N
nωm
bn =
N
∑
m =1
xm sin
N
N
1
a0 =
N
∑x
m =1
m =< x >= 0
For a0 we assume that the signals are made of waves and the average value for
all waves is zero (<x> is the average value of x)
Since finding the spectra is very important mathematicians have found a way to
rapidly perform these mathematical operations and get the same result. This is
called the:
How this is implemented is complicated and you may learn it one day in an
advanced math course in college but the bottom line is the FFT requires
number of operations = N/2p for data sets where the number of time
steps is a power of 2 namely N=2p.
This does not look like a spectrum at all. Also it looks like the result is mirrored
about the point in the center. What is going on ?
The power spectrum which shows us the power of the wave as a
function of frequency. There is a large peak at 2000!
Lets find out how to get from the complex fft fo here, and what the axis mean
The only way to find out is find the FFT of a function that we know all about.
Lets do a sine calculated for 512 time steps.
;
; A PVwave program to play with spectra
; a single sine wave to see what’s what
; W. Gekelman Dec 2003
;
datin = fltarr(512) ; declare array (make space for it)
for i = 0 , 511 do begin ; 512 points
datin(i) = 1.0*sin(2*!pi*float(i)/16.0)
endfor
plot, datin ; plot the sine wave
dfft = fft(datin,-1) ; take fourier transform
;
; examine fft (which is complex)
;
plot, dfft
; examine power in fft abs(dfft)=sqrt(re(dfft)^2+Im(dfft)^2)
plot, abs(dfft)
plot, abs(dfft(0:256)) ; look only in allowed Nyquist part
plot, abs(dfft(0:64)) ; look at the beginning
;
; examine what the real and complex parts look like
;
plot , Real(dfft)
plot, Imaginary(dfft)
end
What does the sine wave look like over the 512 timesteps ?
This looks strange because the FFT returns both the real and imaginary part of the
function. If you ask wave it will tell you that dfft is a complex array of 512 points. It
is symmetric about the midpoint (x=256). What do we do next?
Lets calculate the power spectra (we will discuss what this is later) by:
What good is it? Suppose we have found our spectra in the previous slide and
we want to get rid of all of the signal except for the peak, and see what that
looks like in time.
If we go into the fft of the original signal and cut out the high frequency
Component (we have to do this with the complex fft) and then do an inverse
FFT
In wave > bnew = fft(bfft,+1) +1 means do inverse fft
W. Gekelman
Lecture 5, March 27, 2004
The spectra can tell us if there is a signal present in the data and what the
frequencies of the waves which are in the noise. Are there other techniques we
can use that tell us more about the waves in the noise?
1) How long do they last before they disappear?
Answer Autocorrelation functions
2) Can we separate one wave from the noise and look at it?
Answer Digital Filtering and Cross Spectral Functions
3) Can we find the dispersion relation (how the frequencies and wavelengths are
related) from studying the noise?
Answer Two point Correlation Functions.
u(t)
µ
t
u(t)
There are procedures for this but this wont happen in our
experiment so we will not discuss how to do it
The autocorrelation function tells us the time interval over which a correlation in the
noise exists. If the noise is made entirely of waves, and the waves move through
the plasma (or other medium) without decaying as they travel, the autocorrelation
will be large for all time.
For digital data the autocorrelation is defined as: You get one value of R for
each delay time τ
1 N
Rxx (τ ) = Lim ∑ x (t )x (t + τ ) If x is continuous
N →∞ N
t =1
r∆t
Then do it again and again. For each term you have to slide the data over by a
timestep of ∆t and multiply all the terms. Note that all the term to the right of the
“red” data are zero as are the terms to the left of the blue data. For the
autocorrelation function there is only time history of data. We do this to find out
how long the data are correlated for.
1/2
Red=sine wave
data
White:
autocorrelation
time
Why does the autocorrelation
decay in time ?
1.0
Random “white y=
noise” only with a ( 2π x )
time interval x
Rxx
These cause what is
known as “leakage”
Therefore the cosine function of the infinitely long (in time) autocorrelation of the
sine wave is multiplied by this, which tapers it off.
How do we get around this? Take a the longest possible record. This widens the first
lobe of the sine wave. This is the same sinx and autocorrelation when the record
length is 4096.
Autocorrelation
Of first 512
points
Orig.
Sine
wave
This is the autocorrelation of the magnetic field shown previously (and in red).
Note here the record is 5000 time steps long. It is correlated for less than 50 time
steps (1/100 of the time)
The autocorrelation function and spectra are related to each other by
The Fourier Transform!!
Formally
∞
S xx ( f ) = ∫
−∞
Rxx (τ )e − i 2π f τ dτ
This was proven by Von Neuman and is part of the mathematics of cybernetics or
Information. This was essential for the development of computers
Lecture notes on Waves/Spectra
Noise, Correlations and ….
Formally
∞
S xx ( f ) = ∫
−∞
Rxx (τ )e − i 2π f τ dτ
This was proven by Von Neuman and is part of the mathematics of cybernetics or
Information. This was essential for the development of computers
Huh ?
Suppose you have many waves which start from point a
The waves can decay as they move, or grow. The frequencies of the waves
that make up the signal can change as they move as well.
1) The Cross correlation function tells us how strongly the signal at probe a is
correlated (or related) with that at probe b.
2) The Cross Spectral Function tells us how the signals to the probes are
related frequency by frequency
3) There is (as we can guess) a relation between these functions and FFT’s
The Cross Correlation function is similar to the autocorrelation except now we
have two signals x(t) and y(t). These are the signals from the two probes
respectively.
! 1 N −r
Rxy ( r∆t ) = ∑
N − r n =1
xn yn + r r = 0,1,2,3,...m with m<N
Lets think about what this means. There are a total of N time steps in the data. N
= 1,2,3,4…N. For each value of r we have to sum the product of x and y over all
the n’s. This gives us one value for R. W then have to do the sum/product N-r
times.
" " "
Rxy = Bx B y
*
By at second plane 2
By at first data
meters away
plane
What does the cross correlation look like?
200 = 2 µs
ω/k = ?.
For light in vacuumω = c where c = 3X10
m8
in general
things are simple k sec
ω
In general = f(ω ) here the phase velocity is a complicated function of ω
k
ω= 2πf and we can get f from the spectra (Fourier Transform)
What about k ?
Remember k is the wavenumber where k = 2π/λ
distance (x)
* Strictly speaking the wave could move in any direction so we have to find its wavelength in
all three directions. For now lets discuss wave moving along the x axis only!
1) The wavelength is related to phase changes
2) If we have two probes in the plasma separated by a distance δx, and they
are both simultaneously recording wave data then
the phase change between them is:
3) δθ = k δx k is the wavenumber
Now we have many, many waves going all superimposed and each time we
record data from the two probes it looks different (because the waves are
random)
Now the magnetic field has a real and an imaginary component and is frequency
space There is a similar expression for B2
Now that we have Fourier Transformed each B field we now use
them to find the cross spectral function H.
Position of probe
B2
∑B (x , ω ) B2 ( x2 j , ω )
M
1
H ( χ ,ω ) =
ˆ
" *
1 1j
M j =1
Complex conjugate of
χp = x2 –x1
M = number of events in Fourier transform of B1
(probe separation) which B1 and B2 were
simultaneously stored
H ( χ p ,ω ) =
M
1
ˆ
"
M
∑ B ( x ,ω ) B ( x ,ω )
j =1
*
1j 1 2j 2
H ( χ p , ω ) = C (ω ) + iQ (ω )
"
ˆ
kˆ (ω ) =
1
tan
Q ( ω
−1)
χp P (ω )
Probe separation
Spectra of one of
the signals
2 1/ 2
ω ω k 2
= 1 − +
⊥
VA
k|| ωci ρ cs
B2 qB
VA = ≈ 5 X 107 cm/s ωci = ≈ 7.2 X 105
µ0nM I MI
cs
ρs = ≈ 7mm
ωci
ion cyclotron
−1 Q ( ω )
1
k (ω ) =
frequency
ˆ tan
χp P ( ω )
ion acoustic wave
speed
The Power Spectra Come from the Fourier Transforms of
each Probe. We investigated this in previous lectures
! 1 M *
S1 (ω ) = ∑
M j =1
B 1 j ( x1 , ω ) B1 j ( x1 , ω )
! 1 M *
S2 (ω ) = ∑
M j =1
B 2 j ( x2 , ω ) B2 j ( x1 , ω )
symbol
denotes
average
The Coherency Spectrum is:
H ( χ ,ω )
ˆ
"
γ (ω ) = χ = x2 − x1
Sˆ 1 (ω ) Sˆ2 (ω )
δz horn = 33 cm
Plasma
frequency
Resonance
Correlations
(400 positions)*(3 componets)*(6000
timesteps)*(50 shots)=3.6X108 numbers
B0 Machine axis
Fixed Probe
Movable
Probe
(computer controlled)
|< B" ym B" xf* >|
Coherency γ Byf − Bxm = From 2 plane correlation
|< B" ym >||< B" xf >| measurement
Ave phase
θ = 2.55 radians
δz = 66 cm
T=1000µsec Parallel Ion Flow in a Perpendicular Plane
Time during
spontaneous
fluctuations
+0.05
Mach y
(cm) Correlation
number Measurements
are Made
in this Region
-0.25
I
M || = 12 ln Sat −Upstrem
I Sat − Downstream
x (cm)
Density Fluctuations Due to Drift Waves
Frequency:
0.2Fci
+10
∆n
(%)
n
-10