Description of Software Package Extract for the 

Characterization of the Amplitude and Frequency Noise 

Properties of Cantilevers Used for Nano-MRI

by Doran D. Smith

ARL-TR-4995 September 2009

Approved for public release; distribution unlimited. 
NOTICES

Disclaimers

The findings in this report are not to be construed as an official Department of the Army position 

unless so designated by other authorized documents.

Citation of manufacturer’s or trade names does not constitute an official endorsement or 

approval of the use thereof.

Destroy this report when it is no longer needed. Do not return it to the originator.
Army Research Laboratory

Adelphi, MD 20783-1197

ARL-TR-4995 September 2009

Description of Software Package Extract for the 

Characterization of the Amplitude and Frequency Noise 

Properties of Cantilevers Used for Nano-MRI

Doran D. Smith

Sensors and Electron Devices Directorate, ARL

Approved for public release; distribution unlimited. 
ii

REPORT DOCUMENTATION PAGE Form Approved

OMB No. 0704-0188

Public reporting burden for this collection of information is estimated to average 1 hour per response, including the time for reviewing instructions, searching existing data sources, gathering and maintaining the 

data needed, and completing and reviewing the collection information. Send comments regarding this burden estimate or any other aspect of this collection of information, including suggestions for reducing the 

burden, to Department of Defense, Washington Headquarters Services, Directorate for Information Operations and Reports (0704-0188), 1215 Jefferson Davis Highway, Suite 1204, Arlington, VA 22202-4302. 

Respondents should be aware that notwithstanding any other provision of law, no person shall be subject to any penalty for failing to comply with a collection of information if it does not display a currently valid 

OMB control number.

PLEASE DO NOT RETURN YOUR FORM TO THE ABOVE ADDRESS.

1. REPORT DATE (DD-MM-YYYY)

September 2009

2. REPORT TYPE 3. DATES COVERED (From - To)

FY 2009

4. TITLE AND SUBTITLE

Description of Software Package Extract for the Characterization of the Amplitude 

and Frequency Noise Properties of Cantilevers Used for Nano-MRI

5a. CONTRACT NUMBER

5b. GRANT NUMBER

5c. PROGRAM ELEMENT NUMBER

6. AUTHOR(S)

Doran D. Smith

5d. PROJECT NUMBER

5e. TASK NUMBER

5f. WORK UNIT NUMBER

7. PERFORMING ORGANIZATION NAME(S) AND ADDRESS(ES)

U.S. Army Research Laboratory

ATTN: RDRL-SEE-O

2800 Powder Mill Road

Adelphi, MD 20783-1197

8. PERFORMING ORGANIZATION

 REPORT NUMBER

ARL-TR-4995

9. SPONSORING/MONITORING AGENCY NAME(S) AND ADDRESS(ES) 10. SPONSOR/MONITOR’S ACRONYM(S)

11. SPONSOR/MONITOR'S REPORT

 NUMBER(S)

12. DISTRIBUTION/AVAILABILITY STATEMENT

Approved for public release; distribution unlimited.

13. SUPPLEMENTARY NOTES

14. ABSTRACT

This report describes a software package that was written to support the U.S. Army Research Laboratory’s (ARL) program in 

force-detected nano-magnetic resonance imaging (MRI). The software characterizes the noise found in cantilevers used for 

nano-MRI. The noise can be thermal noise that manifests itself as the Brownian motion of the cantilever, or it can be 

environmentally induced from external forces that excite the cantilever. The program analyzes the noise of both undriven and

driven cantilevers. The program determines the root mean square (RMS) value of the undriven cantilever’s motion versus time 

and its displacement power spectrum. The driven cantilever will experience instantaneous frequency deviations from the 

driving frequency due to Brownian motion. This program determines the instantaneous frequency of the cantilever and 

calculates the mean, standard deviation, and frequency deviation power spectrum of the cantilever’s frequency versus time. 

Although developed to characterize the noise in a cantilever, the analysis preformed here is valid for characterizing the noise on 

a carrier independent of the source of the carrier and its noise.

15. SUBJECT TERMS nano-magnetic resonance imaging, magnetic resonance force microscopy, nuclear magnetic resonance, 

frequency noise, amplitude noise

16. SECURITY CLASSIFICATION OF: 

17. LIMITATION

OF ABSTRACT

UU

18. NUMBER

OF PAGES

26

19a. NAME OF RESPONSIBLE PERSON

Doran D. Smith

a. REPORT

Unclassified

b. ABSTRACT

Unclassified

c. THIS PAGE

Unclassified

19b. TELEPHONE NUMBER (Include area code)

(301) 394-1918

Standard Form 298 (Rev. 8/98)

Prescribed by ANSI Std. Z39.18
iii

Contents

List of Tables v

List of Figures v

1. Introduction 1

2. Description of How the Software Package Works 2

2.1 Data Acquisition or Simulation.......................................................................................4

2.1.1 Data Analysis – 1 ................................................................................................5

2.1.2 Data Analysis – 2 ................................................................................................6

2.2 Intermediate Results........................................................................................................6

2.3 Brownian Motion Results................................................................................................6

2.4 Frequency Deviation Results...........................................................................................7

2.5 Power Spectrum ..............................................................................................................7

2.6 Data Storage ....................................................................................................................7

3. Analytical Techniques Used in Data Analysis 8

3.1 Why We Average Points and Why It’s Okay..................................................................8

3.2 Digital Filtering ...............................................................................................................8

3.3 SW Lock-in .....................................................................................................................8

3.4 Phase to Frequency..........................................................................................................9

3.5 Power Spectrum ..............................................................................................................9

3.6 Calculate the Running Mean and Standard Deviation ....................................................9

3.7 Carrier Removal ............................................................................................................10

4. Optimization of Parameter Settings 11

5. Tests Used to Verify Proper Functioning of the Program 13

6. References 16
iv

List of Symbols, Abbreviations, and Acronyms 17

Distribution List 18
v

List of Tables

Table 1. Parameter values for the low-pass filter in the software lock-in. ...................................11

Table 2. Amplitude settling times for digital filters.......................................................................12

Table 3. Frequency settling times for digital filters.......................................................................13

Table 4. Default parameters used in program testing. ...................................................................14

Table 5. Tests the program passes. ...............................................................................................15

List of Figures

Figure 1. Block diagram of the major functions of the program. ...................................................3
vi

Intentionally Left Blank. 
1

1. Introduction

This report describes a software package that was written to support the U.S. Army Research 

Laboratory’s (ARL) program in force-detected nano-magnetic resonance imaging (MRI) (1, 2). 

The program was written to characterize the noise found in cantilevers used for nano-MRI. The 

noise can originate from thermal noise that manifests itself as the Brownian motion of the 

cantilever, or it can be environmentally induced by external forces that excite the cantilever. The 

program analyzes the noise of both an undriven or driven cantilever. 

An undriven cantilever is a cantilever that has no deliberate external driving forces on it. In a 

well-designed system, when the cantilever is a long way from the sample, its motion should be 

due to Brownian motion only. Most samples induce noise in the cantilever that is fundamental to 

the sample (3). A driven cantilever is driven to finite periodic oscillation amplitude by applying a 

periodic external force to it. The total motion of the driven cantilever is the motion due to (1) the 

driving force, plus (2) the Brownian motion, and (3) any environmental induced noise. We 

assume that the amplitude due to the three possible sources simply adds to give the total 

cantilever displacement. The cantilever could be driven by vibrating the base (base drive) or 

applying an electric or magnetic force to its tip (tip drive). By characterizing the noise of a 

cantilever, several useful things can be determined: (1) whether or not there are any extraneous 

driving forces on the cantilever, e.g., vibrations base driving the cantilever or time dependent 

stray electric fields tip driving the cantilever; (2) whether or not the radio frequency (RF)

magnetic fields used in nano-MRI effect the noise level of the cantilever after the RF has turned 

off; (3) the existence of any forces other than Brownian motion forces, by varying the 

temperature of the cantilever and watching how the noise level depends upon the cantilever 

temperature; (4) the cantilever spring constant, by varying the cantilever temperature; and (5) the 

noise level due to the photon flux in the interferometer.

The program records a cantilever’s position in real-time by monitoring the signal from a fiberbased interferometer that reports the instantaneous position of the cantilever. The program 

determines the root mean square (RMS) value of the undriven cantilever’s motion versus time 

and its displacement power spectrum. Noise-induced motion causes instantaneous frequency 

deviations in a driven cantilever. This program determines the instantaneous frequency of the 

cantilever and calculates its mean, standard deviation, and frequency deviation power spectrum.

Although developed to characterize the noise motion of a cantilever, the analysis preformed here 

is valid for characterizing the noise on a carrier, independent of the source of the carrier and its 

noise. In the rest of the report, the terms carrier and cantilever are both used depending upon 

context. Frequently, carrier is the more convenient term to use, realizing that here the carrier 

represents the position of the cantilever.
2

The main function of this program package is to calculate the power spectrums of (un)driven 

cantilevers. Many of the aforementioned useful things that can be learned about cantilevers are 

learned from the shape of the power spectrums (4–8). 

To verify that this program package was working correctly, it was exercised with two classes of 

test signals—white noise and a coherent side band. Both test signals are built into the program 

package and can easily be substituted for real data. In this case, white noise has its typical 

meaning. The coherent side band used here is a noiseless sine wave of fixed amplitude, a fixed 

number of Hertz from the carrier, and typically much smaller in amplitude than the carrier (a 

single side band). Brownian motion for a cantilever is white noise that is heavily filtered by the 

cantilever’s response function (9). Therefore, testing this program package to determine its 

response to white noise is relevant. Many driven cantilever protocols put side band(s) on the 

carrier; therefore, a coherent side band is also a relevant test. 

2. Description of How the Software Package Works

First a brief overview of the program package is presented, followed by a more detailed 

discussion. A block diagram of the major functions of the software package is shown in figure 1. 

The topmost loop of the program performs the following functions (the numbers in the following 

list correspond to the respective functions in figure 1):

1. gathers or simulates data;

2. scales the raw data from voltage to nanometers;

3. filters the raw data to remove noise that is far away from the carrier frequency;

4. uses a software-based lock-in to demodulate the data from the carrier frequency to 

baseband, outputting points called phase points in quadrature (both an in-phase (X) and an 

out of phase (Y) component);

5. the individual phase points of the lock-in output are used to determine one frequency point,

i.e., typically 40 individual phase points are converted to one small frequency chunk;

6. the small frequency points are then used to calculate a frequency deviation power spectrum 

of the frequency components of the input signal;

7. the small frequency chunks are averaged together to give large frequency point 

(significantly reducing the number of points required to represent the waveform);

8. from the large frequency points the running mean and standard deviation of the carrier 

frequency are calculated;

9. the phase points are averaged together to produce the average phase points; and
3

10. each channel of the averaged phase points is used to calculate a power spectrum of the 

cantilever displacements. 

On each pass through the loop, the successive power spectrums are averaged and the current 

values of the following variables are output (the letters in the following list correspond to the 

respective functions in figure 1):

a. the raw data,

b. the X and Y data, 

c. the running mean and standard deviation of the frequency. Upon the completion of the last 

pass through the loop, the last set of data from items a–c and the following variables are 

displayed—

d. a 2D plot of all the point pairs (X,Y),

e. the average value of the three power spectrums, and

f. a histogram and the running history of the instantaneous values of the cantilever frequency. 

Figure 1. Block diagram of the major functions of the program.

A

B

C

E

F

D

1

2

3 4 5 7

6

8

X

Y

9

1

Top most loop
4

After the topmost loop finishes execution, the RMS values of several variables are calculated and 

data for several plots are prepared and displayed. Once the results have been displayed, all data 

and all values of the parameters used to control the collection and analysis of the data are saved 

to disk.

Now we begin a detailed description of the program. The program is written in LabVIEW 8.5 by 

National Instruments. The control of the program, data collection, data analysis, and display of 

the results is sufficiently involved that tabbed panels are used to organize control and output by 

function.

The following describes which functions the controls provide and how the results are displayed. 

The section headings are the panel names, and the subsection headings are the different controls 

and displays on the panel. The list is not exhaustive, as the meaning of some controls and 

displays are used in program debugging. 

2.1 Data Acquisition or Simulation

Analog-to-Digital Converter (ADC) Setup and Start. This cluster controls the way the data 

acquisition card gathers data. Here the user defines both the signal channel and the lock-in 

external reference frequency channel.

Sample rate (Hz). The sample acquisition rate in samples per second.

# samples. Number of samples to be acquired in each data set.

# of data sets to collect. This control defines the number of data sets to collect. The total number 

of points collected by the program in a single run will be (# samples)* # (of data sets to collect). 

There are undefined time gaps between the collection of each data set.

Simulation of ADC Data. Cluster used to control the simulation of data. Instead of collecting 

data, the program will numerically simulate the data and/or noise with a known pattern. This is 

used extensively in testing the program to verify that it is working correctly and to determine the 

optimal value of filter parameters. 

Simulate ADC Data. This button is selected when the user wishes to simulate ADC data and/or 

noise instead of collect it from the data acquisition card.

Signal Amplitude. Amplitude of the carrier signal.

Signal frequency. Frequency of the carrier signal.

Beginning Phase. Initial phase of the carrier signal.

White Noise Amplitude. The amplitude of the white noise added to the carrier signal. The 

white noise is generated by a National Instruments VI and is very broadband, hence, the 

amplitude must be reasonably large so that once it passes through the filters, there is 

sufficient amplitude left. 
5

Offset Noise Frequency. Defines the frequency of a single tone (coherent noise) added to 

the carrier.

Offset Noise Amplitude. The amplitude of the single tone.

If neither the carrier nor either noise is included, its amplitude is set to zero. Any one, any 

two, or all three (but not zero) may be used.

Use Lock-in Internal Reference Frequency. The button determines whether an external or an 

internal reference frequency is used by the software lock-in. The choice of an external or internal 

reference frequency is based on the experimental needs.

Remove Carrier. The button controls whether or not the carrier is removed from the data before 

it is displayed. Section 3.7 provides a detailed discussion of how carrier removal is implemented 

and its dependence with the internal or external frequency reference.

2.1.1 Data Analysis – 1

Filter on Raw Data. This group of controls sets parameter values for the digital filter 

immediately following the data acquisition card (or simulated data). This filter is typically used 

to remove noise at frequencies far from the carrier, typically 500 Hz or more.

Filter Type. Selects the filter type—low pass, high pass, bandpass, or band reject.

Order. Selects the filter order, which determines how fast the filter response rolls off for 

out of band frequencies.

Low Cutoff Frequency. Determines the cutoff frequency for both the high pass and low 

pass filters. Determines the low frequency cutoff for bandpass and band reject filters.

High Cutoff Frequency. Determines the high frequency cutoff for bandpass and band reject 

filters. Is unused for low pass and high pass filters.

Software Lock-In Control. This cluster controls how the software lock-in functions. The software 

lock-in multiplies the input signal times the reference signal (sine wave) and the reference signal 

shifted by 90° (cosine wave) on a point-by-point basis, yielding an in-phase (X) and quadrature 

output (Y). When the internal reference frequency is used, the sample rate of the internal 

reference is set equal to the data Sample Rate. The lock-in preserves the RMS value of the signal, 

i.e., on point-by-point basis 2 2 OriginalData = X +Y .

Lock-In Reference Frequency. Determines the lock-in’s internal reference frequency, but is 

unused when an external reference is selected.

Bandwidth of Low Pass Filter. Sets the bandwidth of the low pass filter applied to the data 

after it is multiplied by the reference frequency. After the lock-in multiplies the two signals 

together, there will be a baseband component, approximately zero frequency, and a 
6

component at twice the signal frequency. The low pass filter is used to remove the 

component at twice the signal frequency.

Filter Order. Determines the order of the digital filter.

# of Data Points to Delete. Sets the number of data points deleted from the beginning of the 

data set after the data has passed through the digital filter. Due to internal memory in the 

digital filter, it takes time for the digital filter to achieve its steady-state response. By 

deleting some of the initial data, we eliminate the filter’s transient response. The transient 

response affects both the amplitude and frequency of the data, and for precise work can 

introduce significant errors if the data is not deleted. Section 4 contains a discussion of the 

interplay between bandwidth, filter order, and number of points deleted.

# Phase Points in Each Chunk This control sets the number of X and Y phase points in a short 

sequence of phase points (typically 40) that determines the “instantaneous” frequency of the 

carrier. The sequence of points is called a “chunk”. Section 3 describes how the instantaneous 

frequency is calculated.

Parseval’s Relation Is a display of the ratio of the energy in the time domain data to the energy 

in its power spectrum. If the program is working correctly, this ratio should be one. The 

significance of Parseval’s relation is discussed in Proakis and Manolakis, Digital Signal 

Processing Principles, Algorithms, and Applications, 4th ed. 2007, page 238.

The way that Parseval’s Identity has been implemented it is only good for each individual PS, 

not an average of two or more PS’s. So to test Parseval’s Relation, only collect one set of data; 

otherwise this display will be wrong.

2.1.2 Data Analysis – 2

# Points to Be Averaged Together Sets the number of adjacent points to be averaged 

together after the software lock-in but before the displacement (Brownian motion) calculation.

# small frequency chunks to average together Sets the number of adjacent frequency 

chunks that are averaged together to give one large frequency chunk. The large frequency chunks 

are used for the plot of carrier frequency versus time.

2.2 Intermediate Results 

In real time, this panel displays the current row of raw data, and the current X and Y data from 

the software lock-in data sets. It allows the user to watch for sources of experimental disarray.

2.3 Brownian Motion Results

This panel displays three plots that characterize the nature of the displacement of the cantilever. 

The first is a two-dimensional plot of all pairs defined by the X and Y outputs of the lock-in, 

averaged to reduce the number of points by # Points to Be Averaged Together. The data in this
7

plot should form a round, fuzzy, filled-in circle centered on the origin. The next plot displays the 

running mean value and running standard deviation of the X and Y outputs of the lock-in. By 

running values, we mean the time-dependent values as the data is collected. Once enough data 

has been collected to have good statistics, the running mean value and the standard deviation of 

the displacement should converge to their steady-state values. The mean value converges to zero, 

and the standard deviation converges to a nonzero value. By studying these running values and 

their approach to steady-state, it is possible to determine how much data must be collected for 

good statistics to be obtained. This is useful because the amount of data that must be acquired to 

obtain good statistics is dependent upon the individual cantilever and its operating environment. 

Also, if steady-state is never obtained, that means in addition to noise, the system has long-term 

slow drifts in it.

2.4 Frequency Deviation Results

This panel has four plots of the instantaneous frequency deviations of the carrier. All four plots 

use the large frequency chunks. The first one plots in the instantaneous cantilever frequency 

versus time; the second one plots a histogram of these instantaneous frequencies of the 

cantilever; and the third and fourth plots display the running mean and the running standard 

deviation of the cantilever frequency.

2.5 Power Spectrum

The panel displays four power spectrums. Section 3 contains a detailed discussion of how each 

plot is determined and its significance. The first plot displays the power spectra of the 

cantilever’s displacement around its equilibrium position versus the deviation of frequency (fd) 

from the cantilever oscillation frequency (fc). The cantilever’s displacement should be 

proportional to 1/(fd)

2

. The equilibrium position can either be zero for an undriven cantilever, as 

it is for Brownian motion, or a carrier amplitude for a driven cantilever. The second plot is a 

display of the frequency deviation power spectrum of the small frequency chunks versus fd. The 

third plot displays the displacement power spectrum scaled by (f d)

2

/(xrms)

2

, where xrms is the 

RMS amplitude of the driven cantilevers oscillations. This plot should be equal to the frequency 

deviation power spectrum (6), 

The last plot displays the frequency deviation power spectrum multiplied by (xrms)

2

, which 

should result in a frequency deviation power spectrum that is independent of the cantilever’s 

driven amplitude. This is convenient for comparing noise levels under different experimental 

conditions where the drive amplitude of the cantilever may be different.

2.6 Data Storage

This panel allows the user to define a data file path and name where all the data is to be saved. If 

the filename is not given, the program generates a unique one in a default directory.
8

3. Analytical Techniques Used in Data Analysis

3.1 Why We Average Points and Why It’s Okay

Two controls previously discussed, # Points to Be Averaged Together and # Small Frequency 

Chunks to Average Together, average adjacent points together, reducing the amount of data that 

has to be analyzed. Typically we collect data at a 100 kHz for a 1 kHz signal. Once the raw data 

has gone through the software lock-in, the bandwidth of the lock-in the output is only a few 

hertz. We do not need 100 kHz sample rate to accurately represent a signal with only a few hertz 

bandwidth. By averaging adjacent data points, we can significantly reduce the amount of data 

that has to be stored and manipulated but still have a faithful representation of the original signal. 

Additionally, the control # Small Frequency Chunks to Average Together controls how often the 

mean frequency of the signal is determined. Historically, we have found it convenient to 

calculate frequency averages for 1 s.

3.2 Digital Filtering

Digital filtering of the raw data and the lock-in output is accomplished by using LabVIEW's 

built-in filter functions. The filter function used in both cases is a Butterworth filter. The 

Butterworth filter is implemented via an infinite impulse response (IIR) cascade filter called with 

Butterworth coefficients to obtain a Butterworth filtered sequence (10).

3.3 SW Lock-in

For internal reference frequencies, the software lock-in is implemented by multiplying the raw 

data by a reference sine wave to obtain the X channel, and by a reference cosine wave to obtain 

the Y channel. The phase angle of the sine and cosine waves at the beginning of the data set is 

set equal to zero.

When using an external reference, the software lock-in generates internal references locked to 

the external reference to obtain the X and Y channels. The internal reference for the X channel is 

a sine wave at the average frequency and phase of the external reference for each data set. The Y 

channels internal reference is the same sine wave as used for the X channel but is phase shifted 

by 90°.

In general, multiplying two sine waves together results in the sum of two sine waves. One sine 

wave will have a frequency at the sum of the two original frequencies and one at the difference 

frequency. For the case of a lock-in where the data and reference frequencies are close together,

this results in a signal with near zero frequency, which we call base band, and a signal at twice 

the original frequency. The signal at twice the original must be removed by filtering. The 

amplitude of the reference signal is designed such that the amplitude of the original data is 

preserved in the baseband signal, i.e., 2 2 OriginalData = X +Y .
9

3.4 Phase to Frequency

From the X and Y phase of the signal we calculate the instantaneous frequency of the signal. The 

instantaneous frequency calculated is actually a local average over a fraction of a cycle of the 

raw data. The frequency is calculated using a sequence of X and Y phase points of length # 

Phase Points in Each Chunk. The local frequency is calculated using an algorithm due to John 

Marohn (11) . The calculation is based on the knowledge that once the sine (lock-in X output) 

and cosine (lock-in Y output) components of a sine wave with an arbitrary phase angle is known, 

the phase angle θ can be determined with the following relationship θ = arctan(X/Y). The angle 

θ is calculated for all X and Y pairs of the data. Since the arctan function is only unique in the 

range of –90° to +90°, θ runs only between -90°and +90° for all the data. We then unwrap the

phase angleθ . To unwrap θ , the data is run through a LabVIEW routine that watches the 

progression of θ on the input data string. When θ wraps from +90°back to –90°, the unwrap 

function adds 180° to all subsequent θ’s. Therefore, the unwrap function outputs a phase for the 

input signal, which increases monotonically. This phase only deviates from a straight line if there 

was noise in the data. The line is the progression of the signal’s phase, the slope of which is the 

signal’s frequency. By fitting each segment of the phase to a straight line using a least-squares 

fit, the local frequency is obtained. The length of the segment is determined by # Phase Points in 

Each Chunk.

To obtain a good estimate of the local frequency, we find that using 40 points works well. If we 

use less than 20 or 30 points, or more than about 80 points, the calculated frequencies have too 

much noise on them. The noise on the too-few points is due to insufficient signal. The source of 

the noise on the number of points over 80 is more difficult to determine, but is probably numeric. 

For the test data we used, 80 points corresponded to pi/2 of the original waveform. This appears 

to be a trigonometric function issue. 

3.5 Power Spectrum

To compute the power spectrum of either our cantilever displacement or frequency deviations,

we use the power spectrum function as provided by LabVIEW (12). National Instruments defines 

the power spectrum as “Sxx(f) = X*(f)X(f) = |X(f)|2

, where X(f) = F{x(t)}, and X*(f) is the 

complex conjugate of X(f)”, where F{} is the Fourier transform of the time sequence x(t). As 

there are many ways to normalize a power spectrum, we have confirmed that when our time 

domain data contains a signal of a given amplitude and frequency, the power spectrum is 

returning the expected power at the correct frequency. The user should be aware of that power 

spectrums are only an approximation of the power contained in the signal and suffer from the biton problem (13). 

3.6 Calculate the Running Mean and Standard Deviation

By “running mean” and “running standard deviation,” we mean calculation of the mean and 

standard deviation of the data acquired to a given point. Then, as the next data point is collected,
10

the mean and standard deviation are updated to reflect the additional data. Calculating the 

running mean and standard deviation is accomplished with the algorithm:

= 0,∑ = 0,∑ = 0 2 N x x

As each new value comes in, update the following:

= + ∑ = ∑ + ∑ = ∑ + 2 2 2 N N 1, x x value, x x value

and then calculate the new mean and standard deviation as:

mean = (∑x)/ N and [( ( ) ) ( )]1/ 2 2 2 sd = ∑x − ∑x / N / N −1

3.7 Carrier Removal

When characterizing the effect of noise in a system with a carrier present, it is a useful diagnostic 

to remove the carrier to get a direct measurement of the cantilever motion due to noise. For 

example, in a system where Brownian motion should be the only noise source, removing the 

carrier allows us to confirm that the noise has the correct value for Brownian motion.

When a carrier is present, an external reference must be used since an internal reference does not 

know how the phase of the signal changes from data set to data set. It is also not possible to write 

software to auto-phase synchronize from data set to data set. This is because it is impossible for 

the software to tell the difference between phase shifts caused by time delays (non-synchronized 

phases) and phase shifts caused by noise in the data. Therefore, the carrier can only be removed 

when using an exterior frequency reference. After demodulation by the lock-in, the carrier 

appears as a DC value on the X and Y data sets. The algorithm removes the carrier by simply 

subtracting off the DC value of the X and Y data. It does this once all the data sets for the data 

run have been collected. It then removes the overall mean value of each channel, X and Y, of the 

data from the entire data run from each channel.

It is important that the mean be removed at the end of the run for the entire data run and not data 

set by data set. If the mean is removed from each individual data set, it would have the undesired 

side-effect of removing some of the noise amplitude. For example, if data is collected with a 10 s 

data set from a cantilever with an 8 s correlation time, during the 10 s the cantilever can spend all 

of its time far away from the zero mean value and on one side of the mean value. Removing this 

mean value removes the 1/20 of a Hertz (0.05 Hz) component, which, for a cantilever with this 

correlation time, will be large. Our experience is that removing the carrier for each 10 s data set 

from a cantilever that has an 8 s correlation time will cut the Brownian motion to half of its 

value. 

Even removing the mean value of the entire data run suppresses the value of the noise. However,

it only does it at a frequency equal to twice the reciprocal of the total data run collection time. 

For example, if we collect 250 s worth of data (25 10-s data sets), we artificially suppress the 
11

noise component of the data at 1/500 of a Hertz (0.002 Hz). As long as the time, 500 s, is long 

compared to the cantilever correlation time, the value of the 0.002 Hz component should be close 

to zero.

We previously stated that the carrier can only be removed when using an exterior frequency 

reference. This is not an absolute truth; the way around the limitation described in the previous 

paragraphs is to collect only one data set. If the single data set is long enough so that statistics are

good—maybe hundreds to thousands of seconds—an internal reference can be used to remove 

the carrier. The phase relationship between the single data set and the internal reference 

frequency will be arbitrary but constant. As with an external reference frequency, we will 

suppress the value of the noise at a frequency equal to twice the reciprocal of the total data run 

collection time.

4. Optimization of Parameter Settings

This program has many control inputs, several of which need to be optimized to yield a 

satisfactory analysis of the data.

Setting the software lock-in digital filter.

The software lock-in has a built-in digital filter with parameters the user sets. Experience has 

shown that the two sets of values in table 1 yield good results.

Table 1. Parameter values for the low-pass filter in 

the software lock-in.

Filter type Low pass Low pass

Order 4 15

Bandwidth 25 100

How much can we average the software lock-in output and still get Brownian motion that 

looks like the original Brownian motion? For a 100 kHz sample rate, averaging every 200 

points together gives an averaged sample rate of 500 Hz. The averaged data very closely 

resembles the original Brownian motion data. It also has a Nyquist bandwidth of 250 Hz, which

exceeds the 100 Hz bandwidth used by the software lock-in.

Effects of the digital filters on the amplitude and frequency settling times of the filtered

data. 

The value of the filter constants used have a big effect on how long it takes for the filter output 

amplitude and frequency to settle to a steady state when filtering constant input data. This is due 

to the time required for the filter’s internal memory to achieve steady-state. 
12

Amplitude settling.

Table 2 illustrates the amounts of time it takes for a simulated signal of 650 nm peak-to-peak 

(pp), with no noise introduced, to settle to within 0.1 nanometer of its final value at a 100 kHz 

sample rate.

Table 2. Amplitude settling times for digital filters

Simulated 

Signal

Noise Raw data filter Software lock-in low 

pass filter 

Settling 

time to 

Type Order Cut off 0.1 nm

frequency

Bandwidth Order

650 nm 0 Hi pass 20 500 Hz 25 Hz 2 Never 

settles

650 nm 0 Hi pass 20 500 Hz 25 Hz 4 0.13 s

650 nm 0 Hi pass 20 500 Hz 25 Hz 6 0.20

650 nm 0 Hi pass 15 500 Hz 25 Hz 4 0.13

650 nm 0 Hi pass 10 500 Hz 25 Hz 4 0.13

A raw data filter order of 10, 15, or 20 only has a 1–2% effect on the amplitude of the noise 

when no carrier is present. The value of the Brownian motion of a cantilever at 4.2 K for with a 

spring constant of k = 1 x 10–4 N/m is 0.76 nm RMS. We obtain a noise amplitude of 0.796 nm 

RMS when (1) the white noise amplitude = 0.89; (2) an interferometer sensitivity setting of 1500 

nm/V (see the section titled Tests that Extract passes): (3) raw data filter of order = 15; (4) a 

lock-in filter of order 4; and (5) a lock-in bandwidth of 25 hertz.

Effect of filter time constants on frequency settling.

The digital filter also affects the frequency of the data. Determining the local frequency by using 

40 points (# Phase Points in Each Chunk = 40), the number of frequency points that need to be 

averaged together to achieve a frequency estimate that is within less than one micro-Hertz of the 

actual frequency is shown in table 3.
13

Table 3. Frequency settling times for digital filters.

# 40 point frequency 

chunks averaged into 

one frequency

Raw data filter Software lock-in low 

pass filter 

Settling 

time to 

1 μHz

Type Order Cut off 

frequency

Bandwidth Order

1 Hi pass 15 500 Hz 25 Hz 4 osc ±20 

μHz 

forever

2 “ “ “ “ “ “

4 “ “ “ “ “ “

5 “ “ “ “ “ Note 1

Note 1: starts low by 1 micro-Hz and settles to within << 1 micro-Hz by 40 chunks.

The equivalent number of raw data points that must be deleted from the beginning of the data to get steady-state 

results are: 40 raw points/chunks * 40 chunks = 1600 raw data points. We typically delete the equivalent of the first 

2500 raw data points just to be careful.

5. Tests Used to Verify Proper Functioning of the Program

This program package was tested extensively with test signals to make sure that it worked 

properly before being used to analyze actual data. Table 4 lists the values of the parameters 

typically used during the testing process. Table 5 lists all the tests that this program package 

passes.
14

Table 4. Default parameters used in program testing.

Signal Frequency 1000 Hz

Signal Amplitude 10 Vpp (~600 nm pp typically)

Offset Noise Frequency 1 Hz offset

Offset Noise Amplitude 0.017914 V = 0.76 nm RMS

Sample Rate 100 kHz

# Samples 1,030,500 unless otherwise stated.

This is bin-on for frequencies separated by 0.1 Hz

IF scale factor in Global variable file 1500 nm/V

IF scale factor (monitor) in Global variable file 60 nm/V (factor of 25 between this line and the 

previous line)

Raw data filter – Filter Type Hi pass

 - Order 15

 - Frequency 500 Hz

Software lock-in

 - Lock-In Reference Frequency 1010 Hz

 - # of Data Points to Delete 30000 

 - filter type LP (not user settable)

 - Filter Order 15

 Bandwidth of Low Pass Filter 100 Hz

# Phase Pts in Each Chunk 40

For BM extraction

# Points to Be Averaged Together 200 (gives 500 points per sec)

For FD extraction

# small frequency chunks to average together 2500 (gives frequency averages for 1 sec when # 

Phase Pts in Each Chunk = 40)
15

Table 5. Tests the program passes. 

Test 

No.

Test Description

1 Are the RMS values of the driven cantilever before & after the raw data filter correct? 

2 Are the RMS values of coherent side band noise with(out) a driven carrier correct before & after the raw 

data filter?

3 Is the RMS of white noise the same before & after the lock-in without the driven carrier?

4 For coherent noise does Running SD of BM converge to the correct theory value with(out) drive? (Running 

SD of BM means “running standard deviation of Brownian motion”)

5 For filtered white noise (fake cantilever, note 1) does Running SD of BM converge to the same values as 

with(out) drive?

6 Is the displacement power spectrum (dPS) of coherent noise correct for bit-on data with drive? Need 

1030500 samples for dPS to be bit on for a 1 kHz carrier.

7 Do the dPS and frequent deviation power spectrum (fdPS) average correctly?

8 Is the dPS of coherent and white noise the same with(out) drive?

9 Does the fdPS scale correctly from the dPS of coherent and white noise with carrier? (note 2)

10 Is the Running SD of FD correct for coherent noise and white noise with carrier? (Running SD of FD

means “running standard deviation of frequency deviation”)

11 Is the fdPS correct for coherent and white noise with carrier?

12 Is the numerical noise floor with no noise many orders of magnitude below actual signal levels with carrier?

Note 1: By fake cantilever, we mean bandwidth filter the white noise source to a 5 Hz bandwidth, “faking” the white 

noise from a cantilever with a Q = 200.

Note 2: The reference for how the dPS should scale with respect to the fdPS is: John Marohn, Frequency Noise, 

white paper, Cornell University, 2008.
16

6. References

1. Sidles, J. A.; et al. Magnetic Resonance Force Microscopy. Rev Mod Phys Jan 1995, 67

(1).

2. Kuehn, S.; Hickman, S. A.; Marohn, J. A. Advances in Mechanical Detection of Magnetic 

Resonance. J Chem Phys 7 Feb 2008, 128 (5), 052208.

3 Kuehn, S.; Loring, R. R.; Marohn, J. A. Dielectric Fluctuations and the Origins of 

Noncontact Friction. Phys Rev Lett. 2006, 96, 156103.

4. Several excellent references on the Brownian motion of driven and undriven cantilevers and 

their power spectrums are:

5. Yazdanian, S. M.; Marohn, J. A.; Loring, R. F. Dielectric Fluctuations in Force Microscopy: 

Noncontact Friction and Frequency Jitter. J Chem Phys 2008, 128, 224706.

6. Marohn, John. Frequency Noise, white paper, Cornell University, 2008.

7. Marohn, John Marohn. Frequency Noise II, white paper, Cornell University, 2008.

8. See figure 2 of Yazdanian et al. for the typical shape of a power spectrum from a cantilever 

dominated by Brownian motion and finite interferometer photon flux.

9. Marohn, J. A. Harmonic Oscillator Brownian Motion, white paper, Cornell University, 2001

10. National Instruments LabVIEW documentation.

11. Marohn, John. private communication, 2008.

12. LabVIEW by National Instruments help file).

13. See Proakis and Manolakis, Digital Signal Processing Principles, Algorithms, and 

Applications, 4th ed. 2007 for a detailed discussion of these issues.
17

List of Symbols, Abbreviations, and Acronyms

ADC analog-to-digital converter

ARL Army Research Laboratory

dPS displacement power spectrum

fdPS frequency deviation power spectrum

IIR infinite impulse response

MRI magnetic resonance imaging

RF radio frequency

RMS root mean square
18

NO. OF

COPIES ORGANIZATION

1 ADMNSTR

ELECT DEFNS TECHL INFO CTR

ATTN DTIC OCP

8725 JOHN J KINGMAN RD STE 0944

FT BELVOIR VA 22060-6218

1 DARPA

ATTN IXO S WELBY

3701 N FAIRFAX DR

ARLINGTON VA 22203-1714

1 CD OFC OF THE SECY OF DEFNS

ATTN ODDRE (R&AT)

THE PENTAGON

WASHINGTON DC 20301-3080

1 US ARMY RSRCH DEV AND ENGRG

CMND

ARMAMENT RSRCH DEV AND

ENGRG CTR ARMAMENT ENGRG

AND TECHNLGY CTR

ATTN AMSRD AAR AEF T

 J MATTS

BLDG 305

ABERDEEN PROVING GROUND

MD 21005-5001

1 PM TIMS, PROFILER (MMS-P)

AN/TMQ-52

ATTN B GRIFFIES 

BUILDING 563

FT MONMOUTH NJ 07703

1 US ARMY INFO SYS ENGRG CMND

ATTN AMSEL IE TD A RIVERA

FT HUACHUCA AZ 85613-5300

1 COMMANDER

US ARMY RDECOM

ATTN AMSRD AMR

 W C MCCORKLE

5400 FOWLER RD

REDSTONE ARSENAL AL 35898-5000

NO. OF

COPIES ORGANIZATION

1 US GOVERNMENT PRINT OFF

DEPOSITORY RECEIVING SECTION

ATTN MAIL STOP IDAD J TATE

732 NORTH CAPITOL ST NW

WASHINGTON DC 20402

1 US ARMY RSRCH LAB

ATTN RDRL CIM G T LANDFRIED

BLDG 4600

ABERDEEN PROVING GROUND MD

21005-5066

13 US ARMY RSRCH LAB

ATTN IMNE ALC HRR MAIL &

RECORDS MGMT

ATTN RDRL CIM L TECHL LIB

ATTN RDRL CIM P TECHL PUB

ATTN RDRL SEE O D SMITH

(10 COPIES)

ADELPHI MD 20783-1197

TOTAL: 22 (20 HCS, 1 ELECT, 1 CD)