BROAD, FID, XREAL, XIMAG. The array BROAD will contain the decaying exponential function, FID the superimposed cosine waves before weighting with BROAD, and XREAL and XIMAG are the so called 'real' and 'imaginary' parts of the of Fourier Transformation.
TAB = CHAR(9). Here, 9 represents the 'ascii' code for the TAB character, which will be needed later for writing out the data file 'cricket.dat'
STEP = ¼ * K / (N/2) = ¼ * K * 2 / N
Make sure that STEP is a floating point number by correctly converting any integers (ie N or K) using the intrinsic function FLOAT.
FID(n) = FID(n) + AI* COS ( (n-1+T1)*STEP)
Here n (for NMR data at least) has the units of time, and the n-1 arises because you are assumed to measure the value of the FID at time = 0 (ie 1-1) rather than at time=1. T1 corresponds to any time delay before acquisition of the signal. This delay has important consequences regarding the phase of the signal (see below).
BROAD(n) = EXP (-BR * ((n-1)/N) )
where BR is a broadening factor. Note that in the above expression, real and integer numbers are (incorrectly) mixed and your own code should correct this using the FLOAT function. If BR = 0, BROAD(n) = 1; if BR > 0, BROAD contains a decaying exponential function. It turns out the the value of BR controls the WIDTH of the lines contained in XREAL after Fourier transformation. If BR = 0, the lines are infinitely narrow. This might cause arithmetic problems, and you should ensure in your code that BR > 0 under all conditions.
* After calling the subroutine, XREAL and XIMAG contain the real and imaginary parts of the spectrum. Actually, only the first N/2 data locations of each array contain the spectrum (see the Nyquist Theorem above). Write code to normalise each array such that the maximum value of any element in each array is 1 (ie the absolute intensity of the cosine waves is arbitrary).
n-1, BROAD(n), FID(n), XREAL(n), XIMAG(n)
n-1 corresponds to the frequency of the cosine curves present in the FID, and has the value n-1 because the contents of XREAL(1) actually correspond to a zero cosine frequency.
K=4, 17, 24 and 52 with intensities of say AI=1.0, 2.0, 2.0 and 1.0,
the values of the variables XREAL(5), XREAL(18), XREAL(25) and XREAL(53) should be 1.0, 2.0, 2.0 and 1.0. The other locations should contain smaller number, but will not be zero if you used BR != 0, ie the lines are not infinitely narrow. This means the 'spectrum' contains lines at frequencies of 4, 17, 24 and 52 with intensities in the ratio 1,2,2,1.
*
Time/Freq TAB BROAD TAB FID TAB XREAL TAB XIMAG
0 TAB 1.0000 TAB 1.0000 TAB 0.0228 TAB 0.0000
1 TAB 0.9922 TAB 0.1111 TAB 0.0241 TAB 0.0726
...
N N N N/2 N/2
The first row after the * contains the five titles of each column (the above are only suggestions, you can try your own). These will appear eventually to identify the data in the plotting program. TAB means write out character variable TAB = CHAR(9) between each column of data. Using this method, you can write out the full N points of the Time/Freq, BROAD and FID arrays, and only N/2 points of the XREAL and XIMAG arrays. Remember however, that only the first N/2 values of XREAL(n) and XIMAG(n) represent the actual spectrum. Can you interpret what the values of XREAL(1 + N/2) through to XREAL(N) correspond to by inspection of the resultant graphs?
Transfer the file cricket.dat to a Macintosh Computer located in room 170 and plot the contents using the program Cricket Graph. See here on how to mount an Indigo file on a Macintosh
If you want to see how the output of the program should look, you can try running the "executable" only version of the program by typing
demoftnmr
from the console window. The project handed in should of course correspond to your own listing of this program.