I have read [I. Galton 2018] and wanted to understand the effect of

*squaring * deeply. I made a simple experiment to observe the effect of squaring, but I am unable to make sense of the results.

**MATLAB experiment description:** I have taken a sine wave of frequency 100MHz, sampled at the rate 100GHz. To this sine wave, I have added a sinusoidal phase noise of magnitude "alpha" and frequency 10MHz. When I take the FFT of the resultant signal, I get the expected frequency spectrum.

**Code:**clear all
close all;
f0 = 100e6;
df = 10e6;
tTotal= 1e-6;
Fs = 100e9;
Ts = 1/Fs;
t = 0:Ts:tTotal-Ts;
alpha = 1e-6;
a = sin(2*pi*f0*t + alpha*sin(2*pi*df*t)) ;
afft = fft(a)/length(a);
afftdb = 20*log10(abs(afft)+1e-8);
figure(1)
plot(afftdb);

The strength of the spur at bin 111 is 20log(alpha/2) relative to the carrier as expected. Next, I have converted this sine wave into a squarewave, then hann-windowed, then low pass filtered and finally I've taken the FFT.

**Code:**asquare = sign(a);
y = lowpass(asquare,200e6,Fs,'ImpulseResponse','iir','Steepness',0.95);
win = 0.5*(1-cos(2*pi*t/tTotal));
y =y.*win;
%asq_fft = fft(asquare)/length(a);
asq_fft = fft(y)/length(a);
asq_fftdB = 20*log10(abs(asq_fft)+1e-8);
figure(2)
plot(asq_fftdB)

I get spur of strength -64dB which is unexpected for me (see below image). I didn't expect to get this high spur. I expected the spur to still be 20log(alpha/2) relative to the carrier. I also don't understand why I get so many harmonics too.

I also tried changing the value of alpha from 1e-6 to 1e-11. The FFT plot for alpha of 1e-11 is given below:

Still, the strength of the spur didn't change. This is surprising to me. Could anyone please explain why does the spur's strength of -64dB make sense?

When I make alpha = 0, there are no spurs. So, there is no FFT leakage issue here.

[I. Galton 2018] I. Galton and C. Weltin-Wu, "Understanding Phase Error and Jitter: Definitions, Implications, Simulations, and Measurement," in IEEE Transactions on Circuits and Systems I: Regular Papers, vol. 66, no. 1, pp. 1-19, Jan. 2019, doi: 10.1109/TCSI.2018.2856247.