fourierLaser.frink

Download or view fourierLaser.frink in plain text format

// Evaluates Fourier spectrum of a pulsed laser.

signal = new array

s = .001
count = 0
for a = 0 to 2 pi step s
{
   signal@count = sin[10 a]
   count = count + 1
}

for a = 2 pi to 4 pi step s
{
   signal@count = 0
   count = count + 1
}

f = DFT[signal]
len = length[f]

g = new graphics
c = 0
g.color[0,0,0]
p = new polyline
for y = f
{
   x = (c + len/2) mod len      // Draw low-freq components together in middle

   if abs[c] < 200
   {
      // Draw magnitudes
      mag = abs[y]
      p.addPoint[x,-1000 mag]
   }
   c = c + 1
}

g.add[p]
g.show[]


Download or view fourierLaser.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen, eliasen@mindspring.com