From Weak-Signal Measurement to the Birth of the Lock-in Amplifier
If I connect a function generator to the oscilloscope, I can measure the amplitude of a sine wave. If I reduce the amplitude and add a second signal at a different frequency, things get more complicated. And what if mains interference and amplifier noise are added on top of that?
I can reach a point where the trace on the oscilloscope no longer lets me recognize the sine wave. Yet I know something about the signal I am looking for: its frequency, and perhaps I also have a second signal that oscillates together with the first. Can I use this information to measure its amplitude?
This is the question I want to start from. The goal of this journey is to build a lock-in amplifier, but before choosing the op-amps, the filters or the type of detector I want to understand what the circuit has to do.
1. Before the lock-in: the problem of balancing a bridge
In 1934 C. R. Cosens published a paper on a balance detector for AC-excited bridges [1]. The abstract reveals a particularly interesting feature: a balanced valve system makes it possible to use a DC galvanometer, and the direction of its deflection shows which way to adjust the bridge to reach balance.
What makes this indication useful? If I only look at the RMS value of the unbalance voltage, I can tell how far the bridge is from balance, but I lose the sign of the component I am interested in. A reference in phase with the excitation, on the other hand, makes it possible to distinguish the two directions of unbalance. This is an interpretation of the measurement principle, not yet a reconstruction of Cosens’s valve circuit: for that, the original text must be examined.
It is a first link between a strictly electronic problem and phase-sensitive measurement. There is no need to picture a digital circuit or an integrated multiplier straight away.
2. 1941–1949: selectivity and sensitivity
In September 1941 Walter C. Michels and Norma L. Curtis published A Pentode Lock-In Amplifier of High Frequency Selectivity [2]. The title already contains the name lock-in and makes clear which property was being sought: high selectivity. In the abstract the authors describe frequency conversion with a synchronous reference and the use of two pentodes, with the reference applied to the screen grids. They report a response bandwidth of the order of 1 Hz; from the abstract alone I cannot yet reconstruct the component values. In 1949 Michels returned to the subject with Redding in An Improved Synchronous Detector [3]; the abstract explains that the earlier circuit was modified to reduce unwanted feedback and to allow preamplification.
Meanwhile, on 26 March 1949, the MIT Research Laboratory of Electronics published Technical Report No. 105, Low-frequency spectrum of lock-in amplifiers [4]. The title alone shifts the attention to the low-frequency spectral content, which will be important for understanding what happens after demodulation.
These references identify some documented milestones; on their own they do not prove who first invented each form of synchronous detection. The original 1934 and 1941 papers still have to be obtained before their circuits can be reconstructed. The MIT report, on the other hand, is available in full.
MIT’s contribution: phase, noise and sensitivity
I opened Stutt’s report [4] in Unified Documents 1.2.0. In the Source selection (78) I choose the document 1949_stutt_rle_tr105 and open it with Open source (79). The Page field (80) lets me move through the 22 PDF pages; the printed page numbering starts from the fifth page of the file. Figure 32, in section 11, documents the opening.
On pp. 1–3 of the report, Stutt studies a pentode converter. A strong reference modulates the transconductance of the valve: in the small-signal model, the incremental plate current is i(t) = g(t)v1(t). The fundamental component of the transconductance transfers both the useful information and part of the noise to baseband. It is the following filter that determines how much of the noise remains.
On pp. 7–9 the report examines the case of an amplitude-modulated carrier, showing a 3 dB improvement in the signal-to-noise ratio at the optimum phase under the conditions analysed. The result is not a universal limit on lock-in sensitivity. The author also considers the sum of synchronized pulses and distinguishes the coherent growth of the signal from the accumulation of noise.
Pages 16–18 point out a further limitation: if the reference also contains noise, the multiplication introduces new contributions. In the particular case of two signals with incoherent noise analysed at the end of the report, the signal-to-noise ratio can even get worse.
From this I draw three indications for the future design: control the phase, take care of the quality of the reference and define the filter bandwidth. My Worksheet experiment, described further on, uses an ideal reference instead. It is not yet a check of the noisy-reference cases studied by Stutt. The original MIT report lets you consult the figures and equations cited.
3. From the valve circuit to the laboratory instrument
In the 6 March 1967 issue of Electronics, Princeton Applied Research presented two commercial models, the 120 and the 121 [5]. The latter is described as tunable from 1.5 Hz to 150 kHz, with an input-filter quality factor adjustable from 5 to 25, selectable sensitivity and time constants from 1 ms to 100 s. These are specifications stated by the manufacturer in the advertisement, not measurements I have made.
What interests me most is that wide range of time constants. Why should an instrument that measures an AC voltage let me wait for tens or hundreds of seconds? And why, besides the input filter, does it need an output filter?
Another interesting step can be found in European patent application EP0119711A1, published on 26 September 1984 by Princeton Applied Research [6]. The document deals with compensating the offset of the phase-sensitive detector as the reference frequency and the temperature change. So it is not enough to design a circuit that multiplies two signals: the circuit must also be prevented from producing, by itself, a DC voltage that could be mistaken for the signal to be measured. I will come back to this problem when I move on to real components.
In the description of the patent application, the digital control uses a temperature sensor, a measurement of the reference frequency and a calibration memory. The stored values drive analog corrections of offset, gain and phase. What interests me is this distinction between signal processing and correction of the instrument’s errors: even a mostly analog measurement chain can benefit from digital calibration. This is the solution described in the patent, not performance verified on the bench.
4. Opening up the instrument: five blocks to understand
To understand concretely how the signal is transformed inside the lock-in, I opened in GX-TXT, with Unified Documents 1.2.0, the paper by John H. Scofield published in 1994 [7]. The copy consulted consists of four PDF pages. Figure 1 shows a block diagram that helps to get one’s bearings.

Let us follow the upper branch: the signal goes through an AC amplifier, which may include a filter. The lower branch is different: it receives the reference and produces a synchronized waveform with adjustable phase. Where the two branches meet sits the phase-sensitive detector. This is where the fundamental operation takes place. In this diagram the letters PSD stand for phase-sensitive detector, not for the power spectral density we will meet shortly.
At the detector output the measurement is not yet finished. I have to remove the components at non-zero frequency and amplify the DC component that remains. To understand why a DC voltage can be obtained from two AC voltages, it helps to imagine an ideal detector for a moment.
5. How a sine wave becomes a DC voltage
Let A be the peak amplitude, in volts, of the component I want to measure. The signal contains a second component, at a different frequency, and noise. For now I consider a dimensionless sinusoidal reference with unit amplitude, so I do not have to introduce the scale factor of a physical multiplier.
\[ s(t) = A\cos(2\pi f_0 t + \theta) + B\cos(2\pi f_i t + \psi) + n(t) \]
\[ r(t) = \cos(2\pi f_0 t + \varphi) \]
If I multiply only the first component by the reference and apply the product-of-cosines identity, I get
\[ A\cos(2\pi f_0 t + \theta)\,\cos(2\pi f_0 t + \varphi) = \frac{A}{2}\cos(\theta – \varphi) + \frac{A}{2}\cos(4\pi f_0 t + \theta + \varphi) \]
The first term does not depend on time. The second oscillates at twice the frequency. If I filter the product suitably, I can isolate the DC component, which is proportional to the amplitude A and depends on the phase difference.
The interfering component, on the other hand, generates two new frequencies: the absolute difference between fi and f0, and their sum. In the ideal sinusoidal model it produces no DC component if the two frequencies are different. This does not mean it is removed completely: the real filter must be able to attenuate the difference frequency, which could be very small. For noise, an average over a finite interval leaves a residual random component.
The key point
So the lock-in is not a magic amplifier that removes all noise. It moves the coherent part of the signal into a region of the spectrum where I can use a very narrow filter.
6. What really happens inside a PAR 124A?
Scofield performs an experiment with a PAR 124A and an HP 3562A dynamic signal analyzer. The test signal is obtained from the internal 200 Hz oscillator through two series resistors, one of 100 kΩ and one of 1 kΩ; the voltage across the latter is applied to the lock-in input. In the paper, Figs. 3–6 follow the spectrum through the various stages. They are not my simulations but results reported by the author.
At the input, besides the 200 Hz component of interest, there is interference from the American 60 Hz mains and its harmonics. The spectral floor also contains broadband noise and a component that rises at low frequencies. The band-pass filter of the first stage is centred at 200 Hz and set to Q = 5. Yet, looking at the next figure, Scofield points out that the 180 Hz harmonic remains particularly strong.
Let us now see what happens to those frequencies. The 200 Hz component is moved to 0 and to 400 Hz. The 180 Hz interference moves to 20 and to 380 Hz. I can derive these frequencies directly from the trigonometric identity, without reading the curve quantitatively from the plot.
| Component before the product | Difference from the 200 Hz reference | Sum |
|---|---|---|
| Wanted signal: 200 Hz | 0 Hz | 400 Hz |
| Mains: 60 Hz | 140 Hz | 260 Hz |
| Third mains harmonic: 180 Hz | 20 Hz | 380 Hz |
Now the problem has become much simpler: I want to keep what lies near zero and attenuate a component that sits at 20 Hz. For this I no longer need an extremely selective band-pass filter at 200 Hz. I can use a low-pass filter with a very low cutoff frequency.

The figure changes scale: the previous plots went up to 400 Hz, this one only to 20 Hz. The wanted component lies close to zero. Residual components remain; the filter is not ideal. I do not extract a sensitivity or attenuation value from these images, because to do so I would first have to digitize them and evaluate the uncertainty properly.
7. Why isn’t multiplying and filtering enough?
The ideal case already hides some questions. If the reference is shifted by a quarter of a period with respect to the signal, the DC term of the first component is zero, even though a non-zero sine wave is present. A single-phase detector risks not recognizing it. We will see how two references in quadrature make it possible to obtain both amplitude and phase.
Many analog detectors use periodic switching instead of a sinusoidal multiplier. A square-wave reference has harmonics: as a consequence, signals at the reference harmonics can contribute to the demodulated component. The choice between these solutions will be part of the electronic design, not a decision to be taken without analysing its effects.
Moreover, if a very strong interferer saturates the first amplifier, the detector downstream cannot automatically recover the lost information. This makes it essential to study dynamic range, pre-filtering and the noise introduced by the circuit itself.
Try it yourself with GX-TXT
I carried out the experiments that follow with GX-TXT, free software you can install on Linux. There is no need to take my numbers on trust: follow the steps, rebuild the signals and compare your results with mine. Then change something — the frequency of the interference, the length of the integration window, the noise level — and see what happens to the estimate. It is the best way to really understand how a lock-in works, and to have some fun too.
8. I start from the signal I want to measure
Before introducing random noise, I choose a simpler case: a sinusoidal voltage with an amplitude of 1 mV and a frequency of 200 Hz. I want to look separately at this sine wave, at an interfering component at 180 Hz and at the product with the reference.
To work in Mathematics Explorer I use a dimensionless coordinate, x = f0t, where f0 = 200 Hz. One unit of x therefore corresponds to one period of the signal, i.e. 5 ms. I denote by u the voltage divided by 1 mV: u is dimensionless too. In these coordinates the wanted signal is
\[ u_s(x) = \sin(2\pi x). \]
With session S01 open, I go to the Viewers tab of GX-TXT and open Mathematics, which starts Mathematics Explorer. On the left side of the window I find the initial function Sine and the branch Main. I right-click the branch (1) and choose Edit selected… (2).

In the Branch declaration dialog I rename the branch Target normalized (3) and type sin(2*pi*x) in the Expression field (4). I leave the branch limits empty because I want to inherit the global domain. The output unit is also inherited from the function, which uses unit 1. I keep uniform sampling and confirm with Apply (5).

I wait for the plot to be recalculated before doing anything else. In the global domain settings I choose x from 0 to 10 and 1,001 points: I will plot ten periods of the signal, corresponding to 50 ms. Uniform sampling includes both ends of the interval.
I introduce a second sine wave
Before adding a function I check the global limits. In the Domain and numerical sampling window I set Global X minimum (6) to 0, Global X maximum (7) to 10 and Default sample count (8) to 1001. To make the two signals comparable I keep these same limits for the next function as well.
Right-clicking in the upper function table, I choose Add declaration… (9). In the Function declaration dialog I give the name Composite input (10), leave Visible checked and the output unit at 1. I confirm with Apply (11).

I choose a second sine wave at 180 Hz, with an amplitude ten times larger than the first. In normalized coordinates the frequency ratio is 180/200 = 0.9. The overall signal will therefore be
\[ u_{in}(x) = \sin(2\pi x) + 10\sin(1.8\pi x). \]
I select the new function and double-click the Main branch in the table below. In the Branch declaration dialog I give the name Target plus interferer (12), enter the formula sin(2*pi*x)+10*sin(1.8*pi*x) in the Expression field (13) and confirm (14).

At first the plot keeps the scale of the previous sine wave. I wait for the calculation to finish and double-click in the plot area (15): Mathematics Explorer fits the view to both curves.

Let us now look at the blue curve: in these 50 ms it completes ten oscillations. The red curve, instead, also contains a much larger oscillation that completes nine periods in the same interval. If I measured only the amplitude of the red curve, I would not get the millivolt I am looking for. This is a first situation, still free of random noise, in which synchronous detection is worth using.
I multiply the composite signal by the reference
Now I have a reference of unit amplitude, in phase with the wanted signal, i.e. r(x) = sin(2πx). I add a third function to the function table, named Synchronous product, following the same procedure as in Figure 7. I edit its branch, name it Input times reference and enter in the Expression field (16)
\[ p(x) = \left[\sin(2\pi x) + 10\sin(1.8\pi x)\right]\sin(2\pi x). \]
I confirm with Apply (17), leaving the other parameters unchanged. When the calculation is complete I select the new function and its branch.


The green curve is not a DC voltage. In the first part of the domain positive values prevail, while towards the middle of the domain the product also takes on significant negative values. To understand why, I expand the product using trigonometric identities.
\[ p(x) = \frac{1}{2} – \frac{1}{2}\cos(4\pi x) + 5\cos(0.2\pi x) – 5\cos(3.8\pi x). \]
Remembering that x = 200t, I recognize the physical frequencies: 400 Hz, 20 Hz and 380 Hz, plus the constant term 1/2. The period of the 20 Hz beat is exactly 50 ms. I chose the global domain precisely so that it contains one complete period of this component.
I calculate the DC component by integration
If I integrate p(x) between 0 and 10 and divide by the length of the interval, I get the mean value of the product. The three oscillating components complete 20, 1 and 19 periods respectively: their analytical mean is zero.
In Mathematics Explorer I select the synchronous-product branch (18), open Operations (19) and choose Integrate selected (20).

The result appears in the Selected sampled integrals window (21). The value reported is 5, with unit 1 and an actually integrated interval from 0 to 10. The window specifies that the calculation is trapezoidal over the samples: it is not a symbolic integral.

I can now obtain the mean value by dividing the result by 10:
\[ p_{\text{mean}} = \frac{5}{10} = 0.5. \]
For in-phase detection with a unit reference I must multiply this mean by 2, obtaining a normalized amplitude of 1. Going back to the physical scale of 1 mV, I recover the amplitude of the wanted sine wave, even though the interference was ten times larger.
This is a deliberately ideal case: I know the frequency, the reference is in phase and the integration window contains a whole number of periods of the components generated by the product. I have not yet introduced random noise or a real electronic filter. If I change the length of the window, or the difference between the frequencies, this exact cancellation is no longer guaranteed.
I save the model and the results
Procedure in GX-TXT: saving the model and publishing the Datasets (Figures 14–16)
From the File menu I choose Save model to keep the three functions, the domain and the model settings in the session. The model takes the title of the graph, Synchronous detection – normalized target, which is how I will find it when I reopen it. Then I open Publish (23) and choose Graph… (24).

I enter the prefix lockin.s01.gui in the New Dataset ID field (25) and press Publish (26). GX-TXT stores the three branches as separate canonical Datasets and registers the graph in the Plots tab. I wait for the operations to complete before using the Datasets.


The three curves are now available as lockin.s01.gui.s0001, lockin.s01.gui.s0002 and lockin.s01.gui.s0003. I can now check what happens when the window does not contain a complete period of the beat.
9. How long do I need to observe the signal?
In the first experiment I recovered the wanted amplitude exactly. However, I chose an integration window of 50 ms, equal to one period of the beat between 200 and 180 Hz. What happens if I stop observing earlier?
I reopen the model Synchronous detection – normalized target through File → Open… in Mathematics Explorer. I keep the three functions, the amplitudes, the frequencies and the initial phase. I denote by L the upper limit of the normalized domain x, so the physical observation time is T = L/200, in seconds.
The quantity I want to obtain is the in-phase estimate of the sine-wave amplitude. If I call I(L) the integral of the product, I get
\[ I(L) = \int_0^L p(x)\,dx, \qquad \hat{A}(L) = \frac{2}{L}\,I(L)\cdot 1\ \text{mV}. \]
This expression represents an average over a rectangular window, not the behaviour of an RC filter. The factor 2 is the one from the normalization adopted in the previous test.
A window of only 12.5 ms
In the Domain and numerical sampling panel I change the Global X maximum field (28) from 10 to 2.5 and confirm with Enter. I leave 1,001 uniform points (29). I wait for the calculation to finish, then double-click the plot to fit the axes.

Over this interval the green product takes mostly positive values: I have not yet observed the part of the beat that could compensate them. I select the branch Input times reference and repeat Operations → Integrate selected (Figure 12).

Dividing the integral by 2.5 I get a mean value of about 3.85062. Multiplying by 2 and going back to the millivolt scale, I get  = 7.70123 mV. The signal to be measured is still the 1 mV one: I have not changed the functions, only the length of the observation.
Observation time matters
This is an important result. Even without random noise, synchronous detection is not automatically selective. If the window is too short, a component at a nearby frequency can contribute substantially to the estimate. I now want to check the same operation over other lengths.
A 25 ms window
I close the results window, set Global X maximum to 5 and wait for the recalculation. I repeat the integration of the synchronous-product branch, still with 1,001 points.

This time the integral returned by Mathematics Explorer is 2.5. The mean is therefore 2.5/5 = 0.5 and I recover 1 mV. It is interesting that 25 ms were enough, i.e. half a period of the 20 Hz beat. This is not a general rule: in the chosen model all the oscillating terms of the product are cosines with zero initial phase. Over this particular window each of them has positive and negative areas that cancel out. With a different initial phase, this need not happen.
A 37.5 ms window: the sign of the estimate changes
I repeat the procedure with Global X maximum set to 7.5. The integral calculated by the program is now negative.

The in-phase estimate is 2(−4.6262813905)/7.5 = −1.23368 mV. I am not measuring the magnitude of the amplitude, but a signed component relative to the reference. The residual interference is so large that it reverses the sign of the signal estimate. Yet the wanted signal has not changed.
Comparing the results
| L | Duration T (ms) | Numerical integral I(L) | In-phase estimate (mV) |
|---|---|---|---|
| 2.5 | 12.5 | 9.62654322682 | 7.70123 |
| 5 | 25 | 2.5 | 1.00000 |
| 7.5 | 37.5 | −4.6262813905 | −1.23368 |
| 10 | 50 | 5 | 1.00000 |
The fourth row is the result already obtained in Figure 13. In all the tests I kept 1,001 points, including the end points; changing the domain therefore also changes the numerical step. This is not a test at the constant sampling rate of a real acquisition system, but a trapezoidal integration of sampled continuous functions.
I can interpret these results without adding new numerical operations. By integrating analytically the expression of the product derived earlier, for L greater than zero I get
\[ \frac{\hat{A}(L)}{1\ \text{mV}} = 1 – \frac{\sin(4\pi L)}{4\pi L} + 10\,\frac{\sin(0.2\pi L)}{0.2\pi L} – 10\,\frac{\sin(3.8\pi L)}{3.8\pi L}. \]
The corrections oscillate and their amplitude is bounded by an envelope that decreases as 1/L. It does not follow that every increase in duration improves the single estimate: the tests at 25 and 37.5 ms show exactly that. A longer observation does, however, reduce the maximum residual contribution of components at other frequencies. When I introduce random noise, I will instead have to study the spread of the estimates statistically, not just the value of a single integration.
This first deterministic experiment lets me distinguish the role of synchronous detection from that of filtering or averaging. They are two distinct operations, both essential to the design of the circuit.
10. I add noise: building a sampled signal
So far I have used two perfectly deterministic sine waves. The beat can disappear by choosing a suitable window, but a noise voltage does not necessarily repeat after a period. So I want to move from a continuous function to a sequence of samples, so that I can add a random component to each sample and keep exactly the realization used.
The time grid in Scientific Worksheet
In session S01 I open Viewers → Worksheet. I save the new sheet with Save, because guided scientific operations require a Workspace registered in the session. I open Functions (33) and select numeric.uniform_grid (34). I choose a nominal observation interval of 100 ms and a sampling rate of 2,000 Hz: I want 200 samples, without duplicating the end point of the window.
In the start, stop and spacing fields (35) I enter 0, 0.0995 and 200 respectively. In Options (36) I write mode="count": this way the third value is the number of points and not the step. The quotation marks are required for the text value count.
I press Preview fields (37), wait for the calculation to finish, choose Result field = x (38), leave Output cell = A1 (39) and press Apply result (40). The time samples appear in column A (41): 0, 0.0005, 0.001, … The step is 0.5 ms. For the discrete average, the nominal window length will be N/fs = 0.1 s; the last sample is at 99.5 ms.

I generate a realization of white Gaussian noise
In the same Functions panel I select signal.generate.white_noise (42), a guided operation of the signal generator. The time field (43) receives the range A1:A200, i.e. the grid just built. I do not need to specify a frequency or a modulation: in the two middle fields (44) I enter empty().
In Options (45) I write amplitude=5 seed=12345. I am still using the scale normalized to 1 mV. The amplitude parameter of the white_noise generator is the standard deviation of the Gaussian distribution from which the samples are drawn: setting amplitude=5 therefore generates noise with a theoretical standard deviation of 5 mV. The seed makes it possible to repeat the same realization, not to produce independent samples each time it is run with the same seed. The RMS value calculated over a finite sequence can differ from the theoretical one: for the 200 samples it will have to be calculated.
After Preview fields (46), I choose value_real in Result field (47), enter B1 as Output cell (48) and press Apply result (49). Column B (50) now contains the noise, associated with the times in column A. I did not have to write a program: I filled in the fields of the guided operation in the sheet.

I rebuild the signal and the interference on the same grid
I select signal.generate.sine in the Functions panel. I again use A1:A200 as time and empty() as modulation. For the wanted signal I set frequency = 200 (51), Options = amplitude=1 phase_rad=0 (52) and Output cell = C1 (53). After Preview fields I choose value_real and apply the result.

I repeat the same operation with frequency 180 Hz (54), amplitude 10 and phase 0 (55), destination D1 (56). Column C now contains the wanted signal and column D the interference. Column C is also the unit normalized reference, since in this test it is perfectly in phase with the signal.

In Go to (57) I choose E1 and switch to the Cell & Formula tab (58). To add whole vectors I use the sheet function numeric.add, nested twice (59):
=numeric.add(numeric.add(C1:C200,D1:D200),B1:B200)
I press Apply (60). The result fills column E (61), with one input value per sample. The scalar arithmetic operator + cannot be applied directly to these vector ranges: that is why I use the Worksheet’s element-by-element sum function.

The amplitudes are still expressed on the scale normalized to 1 mV; the times are in seconds. Column E includes the wanted signal, the interfering sine wave and the random noise. All the components were generated in the same sheet on the same grid.
The multiplication and the signal-free control
Now I use column C as the unit-amplitude reference. I select F1 and, in Cell & Formula, enter the element-by-element product (62):
=numeric.multiply(E1:E200,C1:C200)
With Apply (63) I get column F. However, I want to compare the result with two controls, keeping the same noise realization. In G1 I build the product without the wanted sine wave; in H1 the product without the random noise:
| Cell | Worksheet formula | Meaning |
|---|---|---|
| F1 | =numeric.multiply(E1:E200,C1:C200) | Product with signal, interference and noise |
| G1 | =numeric.multiply(numeric.add(D1:D200,B1:B200),C1:C200) | Control without signal, same noise |
| H1 | =numeric.multiply(numeric.add(C1:C200,D1:D200),C1:C200) | Deterministic control without noise |


I read the three results of the discrete average
The estimate over N samples, with an in-phase unit reference, is
\[ \hat{A} = \frac{2}{N}\sum_{k=0}^{N-1} p_k \cdot 1\ \text{mV}. \]
In column I I enter the labels Noisy, Null, Clean, Noise RMS and N. In column J I enter the following formulas (67), confirming with Apply:
| Cell | Formula | Displayed result |
|---|---|---|
| J1 | =2*numeric.mean(F1:F200) | 1.3029265 mV |
| J2 | =2*numeric.mean(G1:G200) | 0.30292651 mV |
| J3 | =2*numeric.mean(H1:H200) | 1 mV |
| J4 | =numeric.rms(B1:B200) | 4.4092077 mV RMS |
| J5 | =numeric.count(B1:B200) | 200 |


I note that, without noise, the estimate returns 1 mV. With noise it becomes about 1.303 mV, and even when I remove the wanted signal a component of about 0.303 mV remains. The difference between the first two results is consistent with the millivolt I set, because the two cases share exactly the same realization of the disturbance. I cannot use this subtraction as a universal correction for a real acquisition: two successive measurements do not, in general, contain the same noise.
The RMS value of this realization is 4.409 mV, different from the theoretical standard deviation of 5 mV. The difference is nevertheless compatible with the generator. With a theoretical mean of zero, the quantity N·RMS²/σ² follows a χ² distribution with N = 200 degrees of freedom; for σ = 5 mV, an RMS of 4.409 mV or lower occurs in about 0.9% of realizations. It is a possible result, but this realization falls in the lower tail of the distribution: comparing several independent seeds will show this more clearly. The error observed on the estimate is about 0.303 mV, not a standard uncertainty. To evaluate the latter I will have to study the distribution of results with independent seeds, as the number of samples changes. For now I keep the components, the formulas and the three controls in the sheet.
I look at the signal buried in noise
To compare the wanted sine wave visually with the composite input, I select A1 and open Chart (71). I create a figure with Add selection (72). In the properties I choose X column = A (73), Y columns = C E (74), First row = 1, Last row = 200 (75). I set Kind = line, Panels = overlay, Legend = above, assign the title and press Apply (76).
In this test I ran into a defect of version DEV112 P012, Scientific Worksheet 2.1.2: the chart rejected E1, the source cell of the vector formula, with the message Publication requires real scalar, explicit missing or NaN at E1. The fix to the module lets the chart read the first sample of the vector without changing the formula. The following figures show the result obtained after this local fix. In the unpatched P012 version this step remains blocked.
Micropatch MP004 for GX-TXT DEV112 P012
To repeat this test with P012 I am making available micropatch MP004 (bug 235, ZIP). It is the fourth micropatch in chronological order counting the first one, Algebra, and the third of the subsequent manual fixes.
Close GX-TXT, extract the ZIP and copy the file scientific_worksheet_model_v2.tcl into the subfolder plugins/modules/viewer.scientific_worksheet/api/ of the P012 framework, replacing the existing one. Restart GX-TXT and repeat Chart → Apply. The archive contains only the replacement file and the instructions. If you have installed other micropatches, respect their chronological order and do not overwrite newer files with older ones.
I verified this fix on P012 with the previous micropatches; the file was also compared with the one in the P012-validation copy. I have not repeated the full acceptance test on a freshly downloaded installation. With P012 I wait for Dataset operations to complete before publishing a graph. When the fix is integrated into P013 or a later official patch, it will no longer be necessary to replace the file manually for this defect.


The blue sine wave has a normalized amplitude of 1, while the red waveform spans a much larger range. Yet multiplication by the reference and averaging produced an estimate of 1.303 mV. The visual comparison makes the measurement problem clear, but it is the quantitative check that shows how much of the disturbance remains.
After waiting for the Dataset operations to finish, I also stored the final graph in Plots. In the section on publishing the graph I describe the verified procedure, using the Dataset already available.
11. Two housekeeping steps in GX-TXT
Two operations mentioned in the text are worth documenting for anyone who wants to repeat the work: consulting the 1949 MIT report and storing the final graph in Plots.
Consulting the MIT report in GX-TXT

Storing the graph in Plots
A precaution with GX-TXT DEV112 P012: after a Dataset operation I wait a moment, until it has actually finished, before starting another one or publishing a graph. I also check that there are no Jobs running or queued. I do not repeat a command while the previous operation is still active.
Full procedure in Scientific Dataset Plot (Figures 33–36)
The Dataset of the 200 samples produced by the Worksheet is already available in the session. To obtain the final graph I open Analysis → Scientific Dataset Plot, choose the Dataset worksheet_chart_1796032171581973 as the source and enable Scientific dataset 2D. In Series… I assign the Dataset to the first series (81), X = x and Y = y1 (82), Label = Target (200 Hz) (83), then confirm with Add/update one series (84). For the second series I use the same Dataset, X = x, Y = y2 and Label = Signal + interference + noise. I give the two series distinct IDs.

In Configure… I set the title and the axes (85): Time (s) and Voltage (mV). The numerical values of the voltages normalized to 1 mV coincide with those expressed in millivolts. I set Trace style = line, Point order = dataset_order and Legend content = series (86).

I select Run / recalculate now for Scientific Dataset Plot and open Run. I check the execution plan (87), make sure the operations have finished and press Run enabled analyses (88). I wait for the completion message.

The processing ends with a PASS result. In Plots (89) I select the new graph (90). This is the figure registered in the session, not an external reconstruction of the data.


12. What I have understood so far
The lock-in does not remove noise simply by multiplying the signal by a reference. In the ideal deterministic case, choosing the averaging time makes it possible to cancel the interference. In the random case a component remains that depends on the samples actually observed. To move from the operating principle to the design of an instrument I therefore need to understand how to describe noise, how to measure the signal-to-noise ratio and how to choose an observation bandwidth. These are the questions I will start from next.
The results at a glance
- Deterministic case with a 50 ms window: the in-phase estimate returns 1 mV, even though the 180 Hz interference is ten times larger.
- Same 1 mV signal, windows of 12.5, 25 and 37.5 ms: 7.70123 mV, 1 mV and −1.23368 mV.
- Gaussian noise, 200 samples at 2 kHz: 1.3029265 mV with noise, 0.30292651 mV without the wanted signal, 1 mV without noise; actual RMS value of the noise 4.4092077 mV.
In the next article, When a sine wave disappears into noise, I return to the sampled signal and compare several noise levels and independent realizations.
References
- C. R. Cosens, A balance-detector for alternating-current bridges, Proceedings of the Physical Society 46, 818–823 (1934). Bibliographic data and abstract consulted.
- W. C. Michels, N. L. Curtis, A Pentode Lock-In Amplifier of High Frequency Selectivity, Review of Scientific Instruments 12, 444–447 (1941). Bibliographic data and abstract consulted.
- W. C. Michels, E. D. Redding, An Improved Synchronous Detector, Review of Scientific Instruments 20, 566–568 (1949). Bibliographic data and abstract consulted.
- C. A. Stutt, Low-frequency spectrum of lock-in amplifiers, MIT RLE Technical Report 105, 26 March 1949. Full PDF obtained; abstract and pp. 1–3, 7–9, 16–18 consulted in Unified Documents.
- Princeton Applied Research, advertisement for models 120/121, Electronics, 6 March 1967, p. 44. Data as stated in the advertisement.
- E. A. Faulkner, Princeton Applied Research, Lock-in amplifiers, EP0119711A1, published 26 September 1984. Summary of the application consulted.
- J. H. Scofield, Frequency-domain description of a lock-in amplifier, American Journal of Physics 62, 129–133 (1994). Copy consulted in GX-TXT.