Multiplying two signals: mixing
In the previous article I obtained the amplitude of a sine wave from the mean of the product between the input signal and a known reference. To understand how to perform this operation with a circuit, I want to dwell on the product itself, before taking any mean. What happens to the frequencies if, instead of adding two voltages, I multiply them?
I start from the ideal model: two sinusoidal inputs, no noise, no offset, no saturation. I use GX-TXT v0.9.8.10-dev-112-p012 in the updated working copy, Scientific Worksheet 2.1.2, Math Numeric 1.67.0, Math Signal 1.5.0 and Scientific Dataset Plot 4.4.3. The numbers in this first test are dimensionless; in a real analog multiplier a scale factor with dimensions of inverse voltage will be needed to obtain a voltage at the output.
1. Why do new frequencies appear?
I call the two inputs x(t)=A sin(2πf1t+φ1) and r(t)=B sin(2πf2t+φ2). Subtracting the cosine addition and subtraction formulas I get sin α sin β = [cos(α−β)−cos(α+β)]/2. Therefore
\[ p(t)=x(t)\,r(t) = \frac{AB}{2}\cos\left[2\pi(f_1-f_2)t+\varphi_1-\varphi_2\right] – \frac{AB}{2}\cos\left[2\pi(f_1+f_2)t+\varphi_1+\varphi_2\right]. \]
The frequencies of the product
The output frequencies are |f₁−f₂| and f₁+f₂. They are not simply the frequencies of the two inputs, as would happen in a linear sum. The two peak amplitudes are AB/2 when the components are distinct and do not coincide with DC. The minus sign of the sum component is equivalent to an additional phase of π radians; a plot of the magnitude alone cannot show it.
I choose f₁=200 Hz and f₂=180 Hz, A=B=1, zero phases. I expect a slow component at 20 Hz and a fast one at 380 Hz, each with amplitude 0.5. The first oscillates with a period of 50 ms, the second with a period of about 2.63 ms. The sum frequency is below Nyquist in the test that follows: I am not yet examining the aliasing case.
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 two inputs and their product, and compare your spectra with mine. Then change something — the two frequencies, the relative phase, the amplitudes, or push the sum frequency beyond Nyquist — and see where the new lines end up. It is the best way to really understand what a multiplier does, and to have some fun too.
2. I build the two inputs in the Worksheet
I create a new session from Sessions → Session → New Session, name LockIn_06_mescolamento (1), then Create (2).

In Viewers (3) I search for Worksheet (4) and open the viewer (5). I save the new Workspace before the guided operations.

In Functions I choose numeric.uniform_grid (6), start=0, stop=0.0995, spacing=200 (7), Options=mode="count" (8). I press Preview fields (11), wait for the fields to be captured, select x (9), Output cell=A1 (10) and Apply result (12). The grid contains N=200 samples spaced by 0.5 ms, so fs=2000 Hz, nominal duration N/fs=0.1 s. The last sample is at 99.5 ms. The spacing between DFT bins is 10 Hz: both input frequencies and the expected output frequencies coincide with exact bins.

I select signal.generate.sine (13), time=A1:A200 (14), frequency=200 (15), modulation=empty(), Options=amplitude=1 phase_rad=0 (16). After Preview fields I choose value_real (17), Output cell=B1 (18) and Apply result (19). I read the samples in B1:B200. I do not necessarily expect to read 1 as the sampled maximum: the continuous maxima of the first tone fall between instants of the grid.

I repeat with frequency=180 (20), Output cell=C1 (21), Preview fields and Apply result (22) for the value_real field. I get 18 periods of the second tone in the nominal record, against 20 of the first. The two columns refer to the same instants.

I select D1 (23) and in Cell & Formula I enter (24) the formula =numeric.multiply(B1:B200,C1:C200). I press Apply (25). The product is expanded over the 200 rows of D, without modifying the inputs. For example, at time 1 ms the two samples are about 0.95105652 and 0.90482705; the product read in D3 is about 0.86054166. I am not adding the amplitudes and I am not building a scalar product between vectors. I save the Worksheet.

3. I look for the two frequencies in the spectrum
The shape of the product can look complicated in the time domain. To check its harmonic content I go back to the FFT studied in article 04. In Functions I choose numeric.fft (26), values=D1:D200 (27), Options=nfft=200 normalization="backward" (28). I press Preview fields (31). I capture real (29) with Output cell=E1 (30) and Apply result (32); then I choose imaginary and destination F1, applying the second field of the same run. I wait until both have actually been captured.

The real part in E should contain +50 at bin k=2, i.e. 20 Hz, and −50 at bin k=38, i.e. 380 Hz. Indeed the DFT of a coherent cosine of amplitude C contains NC/2 at each of the two conjugate bins. The negative-frequency partners are at indices 198 and 162; here I keep the full transform in E and F but represent only the 101 non-negative bins.
I select G1 (33) and write (34), with Apply (35): =numeric.multiply(A1:A101,20000). The relation follows from tk=k/fs and fk=k fs/N, so fk=tk fs²/N. The number 20000 is specific to the grid of this test; the values in G are interpreted in Hz.

In H1 (36) I calculate the magnitude, entering the formula (37) and pressing Apply (38):
=numeric.sqrt(numeric.add(numeric.multiply(E1:E101,E1:E101),numeric.multiply(F1:F101,F1:F101)))

The magnitude, unlike the real part, is always non-negative. The two theoretical peaks are both 50. To check the complex coefficients, obtain the dimensionless physical amplitudes of the two tones and compare the time-domain mean and RMS, I select I1 (39) and apply (41) the formula (40):
=vector(E3,E39,F3,F39,H3,H39,H3/100,H39/100,numeric.mean(D1:D200),numeric.rms(D1:D200))

I read the ten results in I1:I10 (42). The Worksheet also shows the vector in the source cell and the expanded values in the following rows. The table summarizes the results, rounded where necessary.
| Quantity | 20 Hz (k=2) | 380 Hz (k=38) |
|---|---|---|
| Real part | 50 | −50 |
| Imaginary part | 1.8169 × 10−13 | −2.6429 × 10−13 |
| Raw magnitude | 50 | 50 |
| Peak amplitude, 2|X|/N | 0.5 | 0.5 |
Dividing by 100 is equivalent to 2/N in these two inner bins; it would not be correct for the DC component or for Nyquist, which have no distinct partner. The time-domain RMS is 0.5. I also check it theoretically: the two cosines are orthogonal over the coherent record, each contributes (0.5)²/2 to the mean of the squares, so RMS=√0.25=0.5. The mean of the product read in I9 is 4.3520743 × 10−16, compatible with zero. The small imaginary parts are calculation residues, not measured noise.
4. Two complementary representations
Procedure in GX-TXT: the two charts, publication and labels (Figures 11–15)
I select A1:D10 as a starting point, open Chart (43) and press Add selection (44). In chart_1 I set X column=A and Y columns=D (45), First row=1, Last row=200 (46), title Product D - 200 Hz times 180 Hz, Kind=line, Panels=overlay, Marker=none. I use X from 0 to 0.1 s and Y from −1.1 to +1.1 (47); I press Apply (48) and Save. I keep all the samples of the product, not only those of the initial selection.

I press Publish immutable Graph to Plots (49) and read the confirmation (50). The Dataset contains 200 samples, the graph is variant p0001.

For the spectrum I create a second view with Add selection without modifying chart_1. In chart_2 I set X column=G and Y columns=H (51), rows 1–101 (52), title Mixer spectrum - raw DFT magnitude. I choose Kind=scatter (53), Marker=circle (54); I set X from 0 to 1000 Hz, Y from −2 to 60 (55), both scales linear. The negative margin does not mean the magnitude can be negative: it serves to avoid hiding the markers on zero. I apply (56), save and publish (57) after the previous operation has completed. I check the confirmation (58).


In Plots I select variant p0002, Presentation → Title and labels; I set X / bottom label=Frequency (Hz) (59), Y Left label=Raw DFT magnitude (dimensionless) (60), then Save (61) and Render → Rerender selected. For p0001 I use the same procedure with Time (s) and Product (dimensionless). The final native graphs are the following.


In the time-domain product a fast oscillation can be seen around a component that varies more slowly: in the first half of the 50 ms period the local level goes from positive to negative and then returns positive. This slow component is the 20 Hz cosine, not a DC voltage. The segments connect samples spaced by 0.5 ms; they are not a measurement of the product between samples. In particular, the 380 Hz component is represented by just over five samples per period.

In the spectrum graph the two high circles at 20 and 380 Hz are 50. The other circles lie practically on zero: for example at 0 Hz the raw magnitude is 8.70 × 10−14, at 10 Hz 8.08 × 10−14 and at 30 Hz 7.60 × 10−14. No bar is interpreted as a bandwidth; the choice of scatter highlights the 101 coefficients actually calculated. The magnitude does not show the opposite sign of the real coefficients, which I have instead checked in the table. There are no significant peaks at the two original frequencies of 180 and 200 Hz. The new frequencies arise from the multiplication, not from the FFT procedure.
The result suggests a question: if I bring the two frequencies to coincide, the difference becomes zero. Can I then obtain a DC component that depends on the relative phase and the amplitude? Before moving on to the filter, I want to compare the product with the simple sum of the tones (beats) and check separately the role of frequency, phase and amplitude.
5. Beats and mixing: two phenomena not to be confused
I have just obtained two new frequencies by multiplying the 200 and 180 Hz sine waves. But if I add them instead, I expect a waveform that can be misleading at first sight: a fast oscillation whose amplitude slowly grows and shrinks. This is the phenomenon of beats. I want to understand whether this slow variation really corresponds to a 20 Hz FFT component.
I use the same two inputs, with unit amplitude and zero initial phase. The trigonometric identity of the sum is
\[ \sin(2\pi f_1 t)+\sin(2\pi f_2 t) = 2\cos\left[\frac{2\pi(f_1-f_2)t}{2}\right]\sin\left[\frac{2\pi(f_1+f_2)t}{2}\right]. \]
With f1=200 Hz and f2=180 Hz, I can rewrite the sum as 2 cos(2π·10t) sin(2π·190t). The slow signed factor is a 10 Hz cosine; the non-negative envelope is 2|cos(2π·10t)| and repeats every 50 ms, i.e. at 20 Hz. The fast factor is a 190 Hz sine. Careful: this is a rewriting of the same signal, not its decomposition into Fourier components. By the linearity of the DFT, the spectrum of the sum must contain only the original tones at 180 and 200 Hz, plus their negative conjugates. Not even 190 Hz is a new line in the spectrum. I check that this really happens.
5.1. Same inputs, different operation
I reopen session S06 and the Worksheet. With Go to (62) I reach J1; I open Cell & Formula (63), enter (64) =numeric.add(B1:B200,C1:C200) and press Apply (65). Column J (66) contains the sum; B and C are unchanged, as is the product already calculated in D. I save the sheet.

In Functions I choose numeric.fft (67), values=J1:J200 (68), Options=nfft=200 normalization="backward" (69). I again use all 200 samples without an additional window: the frequencies coincide with DFT bins. I press Preview fields (72), wait for the capture and choose real (70), Output cell=K1 (71), Apply result (73).

Without changing the input, I select imaginary (74), destination L1 (75) and Apply result (76). In K and L I now have the two components of the complex transform. I do not replace the imaginary part with zero: for sine waves with zero initial phase it is precisely in that component that the significant coefficients of the positive bins lie.

With Go to (77) I reach M1, in Cell & Formula I enter the formula (78) and apply it (79). Column M (80) contains the raw magnitude over the 101 bins from DC to Nyquist; I reuse the G axis already built for the product.
=numeric.sqrt(numeric.add(numeric.multiply(K1:K101,K1:K101),numeric.multiply(L1:L101,L1:L101)))

5.2. I check the four characteristic frequencies
The spacing between bins is still 10 Hz. The frequencies 20, 180, 200 and 380 Hz therefore correspond to rows 3, 19, 21 and 39. In N1 (81) I enter (82) the following formula, then Apply (83). The vector (84) reports the four M magnitudes, the imaginary coefficients at 180 and 200 Hz and the RMS of the sum.
=vector(M3,M19,M21,M39,L19,L21,numeric.rms(J1:J200))

| Frequency (Hz) | DFT magnitude of the product H | DFT magnitude of the sum M |
|---|---|---|
| 20 | 50 | 3.05 × 10−14 |
| 180 | 2.29 × 10−14 | 100 |
| 200 | 4.95 × 10−14 | 100 |
| 380 | 50 | 6.94 × 10−14 |
The values are those of the published Dataset, rounded. The imaginary coefficients L19 and L21 are both −100, in agreement with the backward convention and the zero initial phase. To convert the magnitude of the inner positive bins into peak amplitude I use 2/N: 100 corresponds to 1 and 50 to 0.5. Values of the order of 10−14 are numerical residues, not new measurable components of the ideal model. The RMS of the sum is 1, because the two coherent sine waves are orthogonal over the record and each has a mean square value of 0.5; the product has RMS 0.5, as already verified. I do not infer an electrical gain from this comparison: I am comparing two operations on dimensionless inputs.
5.3. I compare the spectra and the waveform
Procedure in GX-TXT: comparison charts, publication and labels (Figures 23–28)
I select G1:H5 and open Chart (85), then Add selection (86). In chart_3 I set X column=G and Y columns=H M (87), First row=1, Last row=101 (88), title Sum M and product H - raw DFT magnitude. I choose Kind=scatter (89), Marker=circle (90), Panels=overlay, Legend=inside. I use X from 0 to 450 Hz and Y from −3 to 110 (91), linear scales. The X limit highlights the four frequencies I am interested in, without removing the bins up to 1000 Hz from the Dataset. The negative Y margin makes the practically zero points readable. I press Apply (92), wait for the graph and save.

With Publish immutable Graph to Plots (93) I publish chart_3 and check the message (94): the new Dataset has been registered together with variant p0003. I do not repeat the publication while the operation is running.

With Add selection (95) I create chart_4 and set X column=A and Y columns=J (96), rows 1–200 (97), title Beating J - 200 Hz plus 180 Hz, Kind=line, Panels=overlay, Marker=none. I use X from 0 to 0.1 s and Y from −2.2 to +2.2 (98), linear scales; Apply (99), then Save. In the full view the line makes it possible to follow the profile of the beats without crowding the graph with markers.

I also publish chart_4 with Publish immutable Graph to Plots (100) and check the confirmation (101). In this case the 200-sample Dataset is a time-domain source distinct from the spectral one; the new variant is p0004. I close the Worksheet, confirming the save.

In Plots I select p0003 and open Presentation → Title and labels; I set X / bottom label=Frequency (Hz) (102), Y Left label=Raw DFT magnitude (dimensionless) (103), Save (104), then Render → Rerender selected. For p0004 I repeat the procedure with Time (s) (105), Sum (dimensionless) (106), Save (107) and regeneration.



In the spectral comparison I see the two blue circles H of the product at 20 and 380 Hz and the two red circles M of the sum at 180 and 200 Hz. All the other frequencies shown are practically zero; some markers on zero overlap because the two series have the same bins. I used isolated points precisely so as not to suggest the existence of intermediate components. The difference between adding and multiplying is evident: a linear adder preserves the input frequencies, while the ideal multiplier converts them into the sum and difference frequencies.

The waveform of the sum shows the local amplitude shrinking around 25 and 75 ms and growing again around 50 ms. These are the minima and maxima of the envelope predicted by the formula, with samples spaced by 0.5 ms. No envelope detector or filter has been applied.
Beats are an envelope, not a new line
A non-linear detection operation could extract a slow component, but the sum signal, on its own, does not contain the 20 Hz line. The beat frequency describes the rhythm at which the envelope varies; it is not a third additive frequency.
For the lock-in I want precisely the frequency conversion observed in the product, because when the reference has the same frequency as the signal the difference component becomes DC. The next experiment will check this condition and the dependence on relative phase and amplitudes; for now the two frequencies remain different.
6. Same frequency: the relative phase sets the mean value
I now bring the two inputs to the same frequency. I call x(t)=A sin(ωt) and r(t)=B sin(ωt+φ), with ω=2π·200 rad/s. The ideal product is
\[ p(t) = \frac{AB}{2}\cos\varphi – \frac{AB}{2}\cos(2\omega t+\varphi). \]
The frequency difference is zero: the first term is constant; the second oscillates at 400 Hz. The mean value over an integer number of periods, under the sampling conditions of this test, is AB cos φ / 2. This relation describes a dimensionless product; if the inputs were voltages, the product would have units of V² and a conversion coefficient K in V⁻¹ would be needed to obtain an output voltage. I am not simulating that circuit yet.
6.1. Four phases, same frequency
I reuse the first 40 samples A1:A40 of the existing grid, at 2 kHz (nominal duration 20 ms, last sample at 19.5 ms). These are four complete periods at 200 Hz. B1:B40 contains the in-phase signal already generated. In Functions I select signal.generate.sine (108), time=A1:A40 (109), frequency=200, modulation=empty(), Options=amplitude=1 phase_rad=1.5707963267948966 (110), Output cell=O1 (111). I press Preview fields (112), select value_real, then Apply result (113).

I repeat the generation changing only the phase and the destination: pi/4 (114) in P1 (115), pi (116) in Q1 (117), running Preview fields and Apply result for each case. The original inputs B and C are preserved.


| Column | Phase | phase_rad |
|---|---|---|
| B | 0° | 0 |
| P | 45° | 0.7853981633974483 |
| O | 90° | 1.5707963267948966 |
| Q | 180° | 3.141592653589793 |
I calculate the products with Cell & Formula. I reach R1 with Go to (118), enter =numeric.multiply(B1:B40,B1:B40) (119) and press Apply (120). I repeat in the other three cells.

| Cell | Formula |
|---|---|
| R1 | =numeric.multiply(B1:B40,B1:B40) |
| S1 | =numeric.multiply(B1:B40,P1:P40) |
| T1 | =numeric.multiply(B1:B40,O1:O40) |
| U1 | =numeric.multiply(B1:B40,Q1:Q40) |
In V1 (121) I enter (122) and apply (123) the vector of the four means. The result is expanded over the four rows of column V (124).
=vector(numeric.mean(R1:R40),numeric.mean(S1:S40),numeric.mean(T1:T40),numeric.mean(U1:U40))

| Phase | AB cos φ / 2, A=B=1 | GX-TXT |
|---|---|---|
| 0° | 0.5 | 0.49999999999999989 |
| 45° | √2/4 | 0.35355339059327373 |
| 90° | 0 | 1.457167719820518 × 10−16 |
| 180° | −0.5 | −0.5 |
The residue at 90° is compatible with numerical rounding. A zero mean does not mean that the instantaneous product is zero: the alternating term at 400 Hz remains. At 180° the mean is negative because the inputs are in phase opposition. This is why a single phase-sensitive channel is not enough to obtain the amplitude when the relative phase is unknown. The second channel, with a reference in quadrature, will serve to separate the two components; I have not yet verified it as a complete detector.
In W1 (125) I enter =vector(0,45,90,180) (126), obtaining the phase axis in degrees (127).

6.2. Varying the amplitudes
I keep the relative phase at 45° and change the amplitudes before the product. In X1 (128) I enter (129) and apply (130) the following formula; I read the three means in X1:X3 (131).
=vector(numeric.mean(numeric.multiply(numeric.multiply(B1:B40,2),P1:P40)),numeric.mean(numeric.multiply(B1:B40,numeric.multiply(P1:P40,3))),numeric.mean(numeric.multiply(numeric.multiply(B1:B40,2),numeric.multiply(P1:P40,3))))

| A | B | Calculated mean (rounded) |
|---|---|---|
| 1 | 1 | 0.35355339 |
| 2 | 1 | 0.70710678 |
| 1 | 3 | 1.0606602 |
| 2 | 3 | 2.1213203 |
The result grows linearly with each amplitude taken separately and with their product when both vary. In particular, doubling A and tripling B multiplies the mean by six. The data contain no noise and are not a measurement of the linearity of a real multiplier.
6.3. Representing the four values
Configuring the chart of the four points (Figure 38)
I select V1:W4, open Chart and press Add selection. In chart_5 I set X=W, Y=V (132), rows 1–4 (133), Kind=scatter (134), Marker=circle (135), X from −10 to 190 degrees, Y from −0.6 to +0.6 (136), Apply (137). The margins make it possible to display the points at 0 and 180 degrees in full as well. I show only the four verified points; I do not interpolate a theoretical curve between these samples.

The Publish immutable Graph to Plots command registered the Dataset and the following graph. After recovering the Workspace I select p0005 in Plots, open Presentation → Title and labels, set Relative phase (degrees) and Mean product (dimensionless), press Save and then Render → Rerender selected. The letter V in the legend identifies the Worksheet column, not the volt unit.

Reproducibility note: saving, initially blocked by the limit of the History graph, was fixed with MP046 (manual ZIP). Workspace rev. 11, 39 steps and all 40 states verified after reopening in read-only mode. The previous data are unchanged. The 400 Hz spectral component is verified in the following section.
7. What remains at 400 Hz when the mean is zero?
The previous test showed that the product of two 200 Hz sine waves in quadrature has a practically zero mean. That does not mean the output signal has disappeared. To check this I compare two products, the zero-phase one (R) and the 90° one (T), without changing the grid, the amplitudes or the record length.
\[ p_0(t) = 0.5 – 0.5\cos(2\omega t), \qquad p_{90}(t) = 0.5\sin(2\omega t). \]
For each of the two records I have N=40 samples at fs=2000 Hz: the nominal duration is 20 ms, the bin spacing is 50 Hz and Nyquist is 1000 Hz. The 400 Hz term falls exactly on bin k=8 (row 9), and the two records contain eight periods of that component. I apply no additional window and no zero-padding.
7.1. I capture the complex transforms
In the Worksheet, in Functions I choose numeric.fft (138), values=R1:R40 (139), Options=nfft=40 normalization="backward" (140). I press Preview fields (143), wait for the fields to be captured, select real (141), Output cell=Y1 (142), Apply result (144). I keep all 40 coefficients, leaving Result row count empty.

For the same input I choose imaginary (145), Output cell=Z1 (146), Apply result (147). Now Y and Z contain the real and imaginary components of the DFT of the in-phase product.

I repeat on T1:T40 (148), keeping the same Options. I press Preview fields (151), select real (149), Output cell=AA1 (150), Apply result (152). For the imaginary part I choose imaginary (153), Output cell=AB1 (154), Apply result (155). I wait for each capture to actually finish before proceeding.


7.2. Frequency axis and magnitudes
With Go to I reach AC1 (156). In Cell & Formula (157) I enter =numeric.multiply(G1:G21,5) and press Apply (158). G was the 10 Hz grid obtained with 200 samples; multiplying it by five I obtain the 21 non-negative bins of the new record, from 0 to 1000 Hz, with a 50 Hz step. The factor five is the ratio between the lengths 200 and 40, not a universal factor.

In AD1 (159) I apply (161) the formula (160) that calculates the complex norm for each of the 21 bins. I read column AD (162).
=numeric.sqrt(numeric.add(numeric.multiply(Y1:Y21,Y1:Y21),numeric.multiply(Z1:Z21,Z1:Z21)))

In AE1 (163) I repeat (164–165) for AA and AB, obtaining the magnitudes of the quadrature product (166).
=numeric.sqrt(numeric.add(numeric.multiply(AA1:AA21,AA1:AA21),numeric.multiply(AB1:AB21,AB1:AB21)))

7.3. I read the coefficients
Row 1 represents DC; row 9 represents 400 Hz. From columns Y, Z, AA, AB, AD and AE I read the following values, rounded to the precision useful for the comparison.
| Phase | Frequency | Real part | Imaginary part | DFT magnitude |
|---|---|---|---|---|
| 0° | 0 Hz | 20 | 0 | 20 |
| 0° | 400 Hz | −10 | ≈ −8.44 × 10−15 | 10 |
| 90° | 0 Hz | ≈ 5.64 × 10−15 | 0 | ≈ 5.64 × 10−15 |
| 90° | 400 Hz | ≈ 6.44 × 10−15 | −10 | 10 |
With backward normalization, to recover the signed mean I divide the real part of the DC bin by N: 20/40=0.5 in the first case, about 1.41 × 10−16 in the second. For the peak amplitude of the 400 Hz component, an inner bin, I instead use 2|X8|/N: in both cases I obtain 2·10/40=0.5. The factor two recombines the two conjugate coefficients of the sine wave. The change from a negative real coefficient to a negative imaginary one reflects the phase shift of the double-frequency term. Residues of the order of 10−15 are compatible with the numerical errors of the ideal test.
The phase sets the DC, not the 400 Hz term
This is the fundamental distinction: the phase governs the DC component, but not the amplitude of the double-frequency component. For a single-phase lock-in it will therefore be necessary to separate the DC term from the alternating one with a low-pass filter. The mean over a coherent record performs this separation under ideal conditions; a real filter will also have dynamics and a noise bandwidth, which I will study in the following articles.
7.4. Graphical comparison
Configuring the two-panel chart (Figure 47)
I select AC1:AE5 and open Chart, then Add selection to create chart_6. I set X column=AC and Y columns=AD AE (167), First row=1, Last row=21 (168). I choose Kind=scatter (169), Panels=separate (170), Marker=circle (171). I use the same limits on both panels: X from −25 to 1025 Hz (172), Y from −1 to 22 (173). I press Apply (174), wait for the regeneration and choose Publish immutable Graph to Plots (175). Choosing two panels prevents coincident markers from hiding each other; the same spans make it possible to compare the values directly.


In the upper panel I read the DC point at 20 and the 400 Hz peak at 10. In the lower panel the former disappears on the scale of the graph, while the 400 Hz peak remains identical. The published CSV Dataset contains all 21 bins and confirms the two magnitudes at 400 Hz (9.9999999999999964 and 10.000000000000004). The residual differences are numerical. I do not join the points: I have calculated only the discrete coefficients. The labels AC, AD and AE are the column names; the graph is the first version published in Plots.
7.5. Panel labels in Plots
Procedure in GX-TXT: panel titles and labels (Figures 49–51)
To make the phase difference explicit, I open Plots, select p0006 (176), open Presentation (177) and choose Title and labels (178).

I write Frequency (Hz) in X / bottom label (179). For panel_1 I set In phase (0 degrees) as Panel title (180) and Raw DFT magnitude (dimensionless) as Panel Y Left label (181). In panel_2 I write Quadrature (90 degrees) (182) and the same Y label (183). I press Save (184).

From the Render menu (185) I choose Rerender selected (186) and wait for the message Plot rerendering completed.


Reproducibility note (P012). In the initial version, the saved X / bottom label field was not applied to multi-panel graphs (bug 289). The fix MP050 (manual ZIP) was verified in the same session. With GX-TXT closed, I extract the ZIP into the framework directory, replacing only the file indicated in the README; I restart GX-TXT and regenerate the graph. Figure 52 is the native PNG obtained in this way, with the common label Frequency (Hz). The data and the Y labels of the panels are unchanged. Anyone using P012 must apply the micropatches in chronological order.
I saved the Worksheet and the session configuration. The exported archive contains the Workspace at revision 15 and the six published graphs; the integrity of the ZIP and the scientific files have been checked. I have not yet re-imported the archive.
8. What I learned about the multiplier
At the beginning I had two sine waves and a question about frequencies. Now I can distinguish three situations that would be easy to confuse by looking only at the waveforms.
The results at a glance
| Operation | Inputs | Verified result |
|---|---|---|
| Sum | 200 and 180 Hz | Spectral lines at 200 and 180 Hz, beat envelope at 20 Hz |
| Product | 200 and 180 Hz | Components at 20 and 380 Hz, each with amplitude 0.5 |
| Product | Both at 200 Hz, relative phase 0° | Mean 0.5; 400 Hz component with amplitude 0.5 |
| Product | Both at 200 Hz, relative phase 90° | Mean practically zero; 400 Hz component with amplitude 0.5 |
The input amplitudes in this table are unity. When they vary, the mean in the coherent case follows AB cos φ / 2, as we also checked at 45°. The product is not yet a selective measurement: it shifts the frequencies, but lets through both the difference term and the sum term. If the reference has the same frequency as the wanted signal, the first component moves exactly to zero; if it has a different frequency, an oscillating component remains.
It is precisely this conversion that makes the multiplier interesting for a lock-in: after moving the useful signal close to zero, I can try to separate it from the other frequencies with a filter. An ideal filter and a finite mean, however, are not the same thing. What happens if the useful signal is accompanied by a larger interference, and for how long must I observe the product to tell the two contributions apart? This will be the starting point of the next article, Single-phase synchronous detection.
The checks in this article concern the ideal mathematical model: coherent samples, sine waves with no noise or offset, no saturation and no aliased spectral components. They do not yet demonstrate the performance of a real circuit, nor its sensitivity in the presence of noise. The filter, the conversion to voltage and the experimental limits remain to be studied.