The purpose of this assignment was to explore the properties of Fourier transforms. Specifically, 1. To confirm using idl (or other appropriate software) the Fourier transforms of elementary functions given in Lena. 2. To verify using idl (or other software) the Wiener-Khinchine (or Autocorrelation theorem). 1. I explored the following elementary functions: sine -> odd pair of delta functions cosine -> even pair of delta functions comb function -> comb function gaussian function -> gaussian function tophat function -> sinc function Observations: Imaginary part of FT was used for the sine function, whereas the real part of the cosine FT was used. It is important to carefully define indices. Quite a few acrobatics were required to match up the appropriate indices so that the x-axis was labelled appropriately and the appropriate function was transformed. 2. Since idl computes the autocorrelation of a function via the W-K theorem, I computed the autocorrelation explicitly. Below is a list of the autocorrelation functions of the elementary functions explored: sine -> cosine cosine -> cosine comb -> comb gaussian -> broader gaussian tophat -> triangular wave/function Observations: For each elementary function I was able to confirm the W-K theorem. Namely that the Fourier Transform of the autocorrelation function is equal to the Fourier Power Spectrum. For each function the following was plotted: 1. The function itself. 2. The FT of the function. 3. The Fourier Power spectrum. 4. The inverse transform of the FT ( = the function itself) 5. The autocorrelation function. 6. The FT of the autocorrelation. As expected, 1=4 and 3=6. idl programs are attached and can also be found at: /reya/shuleen/ay203/ft/ wksin.pro wkcos.pro wkgauss.pro wkcomb.pro wktophat.pro *********************************************************************** ;First compute the Fourier Power spectrum and plot: n=100 ;number of sample points t=2./n ;sample time ;Here are a few acrobatics to deal with the midpoint mp=n/2 +1 ;define midpoint f=findgen(n) f[mp] = mp -n + findgen(mp-2) ;define x array x=f*t ;define frequency array (purely for plotting purposes) f=f/(n*t) FX=sin(!pi*x) ;define function FT=fft(FX) ;compute Fourier Transform PT=FT*conj(FT) ;compute Fourier Power spectrum FXI=fft(FT,/inverse) ; compute the inverse transform ;Now compute the autocorrelation of FX - first need to make a large matrix for fx mp1=n+1 f1=findgen(4*n) f1[mp1] = mp1 -4*n + findgen(mp1-2) x1=f1*t y1=shift(x1,-mp1) temp=fltarr(4*n,4*n) for i=50,349 do for j=150,249 do temp(i,j)=sin(!pi*y1(i))*sin(!pi*(y1(i)+y1(j)))*t temptot=total(temp,1) FA=temptot(150:249) FA1=shift(FA,mp) PA=fft(FA1) ;plot results !P.MULTI=[0,2,3,0,0] plot, shift(x, -mp), shift(FX, -mp),title='1. SINE FUNCTION',xtitle='x (units of pi)',ytitle='f(x)=sin(x)' plot, shift(f, -mp), shift(imaginary(FT), -mp),title='2. FOURIER TRANS OF SINE FXN - IMAGINARY',xtitle='f (units of 1/pi)',ytitle='F(f)',xrange=[-20.,20.] plot, shift(f, -mp), shift(PT, -mp),title='3. FOURIER TRANS POWER SPECTRUM',xtitle='f (units of 1/pi)',ytitle='P(f)',xrange=[-20.,20.] plot,shift(x,-mp),shift(FXI,-mp),title='4. INVERSE TRANSFORM OF THE TRANSFORM',xtitle='x' plot,shift(x,-mp),shift(FA1,-mp),title='5. AUTOCORRELATION OF SINE FXN' plot,shift(f,-mp),shift(PA,-mp),title='6. FOURIER TRANSFORM OF THE AUTOCORRELATION OF SINE',xrange=[-20,20] ;------------------------------------------------------------------------------ ;First compute the Fourier Power spectrum and plot: n=100 ;number of sample points t=2./n ;sample time ;Here are a few acrobatics to deal with the midpoint mp=n/2 +1 ;define midpoint f=findgen(n) f[mp] = mp -n + findgen(mp-2) ;define x array x=f*t ;define frequency array (purely for plotting purposes) f=f/(n*t) FX=cos(!pi*x) ;define function FT=fft(FX) ;compute Fourier Transform PT=FT*conj(FT) ;compute Fourier Power spectrum FXI=fft(FT,/inverse) ; compute the inverse transform ;Now compute the autocorrelation of FX - first need to make a large matrix for fx mp1=n+1 f1=findgen(4*n) f1[mp1] = mp1 -4*n + findgen(mp1-2) x1=f1*t y1=shift(x1,-mp1) temp=fltarr(4*n,4*n) for i=50,349 do for j=150,249 do temp(i,j)=cos(!pi*y1(i))*cos(!pi*(y1(i)+y1(j)))*t temptot=total(temp,1) FA=temptot(150:249) FA1=shift(FA,mp) PA=fft(FA1) ;plot results !P.MULTI=[0,2,3,0,0] plot, shift(x, -mp), shift(FX, -mp),title='1. COSINE FUNCTION',xtitle='x (units of pi)',ytitle='f(x)=cos(x)' plot, shift(f, -mp), shift(float(FT), -mp),title='2. FOURIER TRANS OF COSINE FXN - REAL',xtitle='f (units of 1/pi)',ytitle='F(f)',xrange=[-20.,20.] plot, shift(f, -mp), shift(PT, -mp),title='3. FOURIER TRANS POWER SPECTRUM',xtitle='f (units of 1/pi)',ytitle='P(f)',xrange=[-20.,20.] plot,shift(x,-mp),shift(FXI,-mp),title='4. INVERSE TRANSFORM OF THE TRANSFORM',xtitle='x' plot,shift(x,-mp),shift(FA1,-mp),title='5. AUTOCORRELATION OF COSINE FXN' plot,shift(f,-mp),shift(PA,-mp),title='6. FOURIER TRANSFORM OF THE AUTOCORRELATION OF COSINE',xrange=[-20,20] ;------------------------------------------------------------------------------ ;First compute the Fourier Power spectrum and plot: n=100 ;number of sample points t=2./n ;sample time ;Here are a few acrobatics to deal with the midpoint mp=n/2 +1 ;define midpoint f=findgen(n) f[mp] = mp -n + findgen(mp-2) ;define x array x=f*t ;define frequency array (purely for plotting purposes) f=f/(n*t) ;******************************* FX=exp((-x^2)*10.*!pi) ;define function ;******************************* FT=fft(FX) ;compute Fourier Transform PT=FT*conj(FT) ;compute Fourier Power spectrum FXI=fft(FT,/inverse) ;Now compute the autocorrelation of FX - first need to make a large matrix for fx mp1=2*n+1 f1=findgen(4*n) f1[mp1] = mp1 -4*n + findgen(mp1-2) x1=f1*t y1=shift(x1,-mp1) temp=fltarr(4*n,4*n) for i=50,349 do for j=150,249 do temp(i,j)=exp((-1*(y1(i)^2+(y1(i)+y1(j))^2))*10.*!pi)*t temptot=total(temp,1) FA=temptot(150:249) FA1=shift(FA,mp) PA=fft(FA1) ;plot results !P.MULTI=[0,2,3,0,0] plot, shift(x, -mp), shift(FX, -mp),title='1. GAUSSIAN FUNCTION',xtitle='x (units of pi)',ytitle='f(x)' plot, shift(f, -mp), shift(float(FT), -mp),title='2. FOURIER TRANS OF GAUSSIAN FXN - REAL',xtitle='f (units of 1/pi)',ytitle='F(f)' plot, shift(f, -mp), shift(PT, -mp),title='3. FOURIER TRANS POWER SPECTRUM',xtitle='f (units of 1/pi)',ytitle='P(f)' plot,shift(x,-mp),shift(FXI,-mp),title='4. INVERSE TRANSFORM OF THE TRANSFORM',xtitle='x' plot,shift(x,-mp),shift(FA1,-mp),title='5. AUTOCORRELATION OF GAUSSIAN FXN' plot,shift(f,-mp),shift(PA,-mp),title='6. FOURIER TRANSFORM OF THE AUTOCORRELATION OF GAUSSIAN' ;------------------------------------------------------------------------------ ;First compute the Fourier Power spectrum and plot: n=100 ;number of sample points t=2./n ;sample interval ;Here are a few acrobatics to deal with the midpoint mp=n/2 +1 ;define midpoint f=findgen(n) f[mp] = mp -n + findgen(mp-2) ;define x array x=f*t ;define frequency array (purely for plotting purposes) f=f/(n*t) ;******************************* FX=fltarr(n) .run tophat.pro for i=0,n-1 do FX(i)=tophat(x(i)) ;******************************* FT=fft(FX) ;compute Fourier Transform PT=FT*conj(FT) ;compute Fourier Power spectrum FXI=fft(FT,/inverse) ;Now compute the autocorrelation of FX - first need to make a large matrix for fx mp1=2*n+1 f1=findgen(4*n) f1[mp1] = mp1 -4*n + findgen(mp1-2) x1=f1*t y1=shift(x1,-mp1) temp=fltarr(4*n,4*n) for i=50,349 do for j=150,249 do temp(i,j)=tophat(y1(i))*tophat(y1(i)+y1(j))*t temptot=total(temp,1) FA=temptot(150:249) FA1=shift(FA,mp) PA=fft(FA1) ;plot results !P.MULTI=[0,2,3,0,0] plot, shift(x, -mp), shift(FX, -mp),title='1. TOPHAT FUNCTION',xtitle='x (units of pi)',ytitle='f(x)' plot, shift(f, -mp), shift(float(FT), -mp),title='2. FOURIER TRANS OF TOPHAT FXN - REAL',xtitle='f (units of 1/pi)',ytitle='F(f)',xrange=[-4,4] plot, shift(f, -mp), shift(PT, -mp),title='3. FOURIER TRANS POWER SPECTRUM',xtitle='f (units of 1/pi)',ytitle='P(f)',xrange=[-4,4] plot,shift(x,-mp),shift(FXI,-mp),title='4. INVERSE TRANSFORM OF THE TRANSFORM',xtitle='x' plot,shift(x,-mp),shift(FA1,-mp),title='5. AUTOCORRELATION OF TOPHAT FXN' plot,shift(f,-mp),shift(PA,-mp),title='6. FOURIER TRANSFORM OF THE AUTOCORRELATION OF TOPHAT',xrange=[-4,4] ;------------------------------------------------------------------------------ ;First compute the Fourier Power spectrum and plot: n=100 ;number of sample points t=2./n ;sample time ;Here are a few acrobatics to deal with the midpoint mp=n/2 +1 ;define midpoint f=findgen(n) f[mp] = mp -n + findgen(mp-2) ;define x array x=f*t ;define frequency array (purely for plotting purposes) f=f/(n*t) ;******************************* p=10 FX=fltarr(n) for i=0,n-1,p do FX(i)=1.0 ;******************************* FT=fft(FX) ;compute Fourier Transform PT=FT*conj(FT) ;compute Fourier Power spectrum FXI=fft(FT,/inverse) ;Now compute the autocorrelation of FX - first need to make a large matrix for fx mp1=n+1 f1=findgen(2*n) f1[mp1] = mp1 -2*n + findgen(mp1-2) x1=f1*t ;******************************* p=10 FX1=fltarr(2*n) for i=0,2*n-1,p do FX1(i)=1.0 ;******************************* temp=fltarr(n,n) for i=0,n-1 do for j=0,n-1 do temp(i,j)=FX1(i)*FX1(i+j)*t FA=total(temp,1) PA=fft(FA) ;plot results !P.MULTI=[0,2,3,0,0] plot, shift(x, -mp), shift(FX, -mp),title='1. COMBFUNCTION',xtitle='x (units of pi)',ytitle='f(x)=cos(x)' plot, shift(f, -mp), shift(float(FT), -mp),title='2. FOURIER TRANS OF COMB FXN - REAL',xtitle='f (units of 1/pi)',ytitle='F(f)',xrange=[-20.,20.] plot, shift(f, -mp), shift(PT, -mp),title='3. FOURIER TRANS POWER SPECTRUM',xtitle='f (units of 1/pi)',ytitle='P(f)',xrange=[-20.,20.] plot,shift(x,-mp),shift(FXI,-mp),title='4. INVERSE TRANSFORM OF THE TRANSFORM',xtitle='x' plot,shift(x,-mp),shift(FA,-mp),title='5. AUTOCORRELATION OF COMB FXN' plot,shift(f,-mp),shift(PA,-mp),title='6. FOURIER TRANSFORM OF THE AUTOCORRELATION OF COMB',xrange=[-20,20]