#Octave #SDR
Very minimalist QRP amateur radio transceivers, such as the uSDX and QMX, use a polar approach for SSB modulation.
However, after demodulation with synchronous detection, the signal is more or less distorted, depending on the type of modulation signal. A sine sweep remains unchanged, speech is distorted but intelligible, and music is reduced to nothing but noise.
I created a simulation in Octave that confirms this result (see block diagram).
Where is the flaw in this approach? Why, for example, is speech reproduced only as distortion after demodulation?
Does this have to do with the discontinuity of the atan2() function used to calculate the phase? If so, is there a better way to correct for this discontinuity?
When calculating the phase difference and getting a negative result, I simply added 2*pi.
Have you considerd the Audio Bandpass filter used in phone communication. Normmaly phone modulation is Cut off below 300Hz and above 2700Hz (This will fill an SSB IF Filter with BW=2400Hz). The reason for SSB filtering is that the bandwidth on RF has to be limited, and that the human voice do not need HiFi quality. Also inserting an Carrier gets easy if the gurantieed minimum distance is 300Hz (both for DSP "autoinsert BFO" and Analog BFO).
The Hilbert transformer can handle the bandwidth of the signals. Nevertheless, distortion occurs.

This 'Kahn Modulation' is very sensitive to a mismatch in time delay from magnitude path to phase path. Adding additional delay may help.
Thanks for the tip. In addition to slightly better phase correction at the -pi/+pi discontinuity of arctan2(), I optimized the timing between phase and magnitude. This resulted in 10 dB better sideband suppression and 10 dB less energy at the upper end beyond the band limit.
But it’s still far from perfect — see the plot in reply to KA9Q.
What's the reason for the phase differentiator (δφ/δτ)? 'Polar modulation' is better described as "rectangular to polar conversion" where 2-dimensional (or complex) signal vectors expressed in cartesian X/Y (or I/Q) coordinates are converted to phase (φ) and magnitude (or amplitude, or envelope) components.
The phase component is non-linearly amplified and the amplitude component is re-applied at high level, eg, by varying the plate, collector or drain supply voltage. Note that the phase component is used directly, there is no differentiator.
Why do this? Because linear RF power amplifiers are notoriously inefficient, while the most efficient amplifiers are invariably the most nonlinear. This lets you have your cake and eat it too: you get the efficiency of a high power nonlinear RF amplifier but the overall system becomes linear again when the envelope information is re-applied to the final RF stage. This technique is also known as Envelope Elimination and Restoration (EER) and in broadcasting it has a long history: nearly 90 years! During the 1970s and 1980s AMSAT-DL (Germany) specialized in the design and construction of high efficiency linear RF satellite transponders using various forms of EER: the one I just described and a second method known as "outphasing" (or "ampliphase") where two nonlinear RF amplifier outputs are combined and the amplitude is varied by changing the relative drive phase of the two amplifier chains.
But unless you're designing a high efficiency linear transmitter (a worthy goal) there's no need to simulate this complexity. If you're just generating and demodulating SSB, use quadrature mixing at both the transmitter and receiver. That is, the transmitter uses two separate mixers fed by an LO with two outputs, one 90 degrees offset in phase relative to the other. When you combine the outputs you get either USB or LSB depending on whether you add or subtract the two mixer outputs.
Use the same process at the receiver: two mixers fed by a quadrature LO and the outputs added or subtracted to select the upper or lower sideband.
In DSP all this is most easily done in complex arithmetic. Generate your quadrature LO by repeatedly multiplying a complex unit vector by a complex unit "step" vector chosen for the desired phase step per sample:
float complex input;
float complex lophase = 1 + I*0;
float complex step = cexpf(2*M_PI*I*f); // f = frequency in fractional rotations per sample
while(true){
input = get_input();
float complex output = input * lophase;
lophase *= step; // normalize this occasionally to limit roundoff errors
transmit(crealf(output)); // send real component to linear RF amplifier *or*
transmit_polar(cabsf(output), cargf(output)); // send polar magnitude and phase to EER RF amplifier
}
Complex mixing is just like ordinary "real" mixing except that instead of getting both sum and difference frequencies, you only get the sum. If 'f' is positive, you will shift the input frequencies up; if 'f' is negative, you will shift them down. The transmitter up-shifts a baseband audio signal (starting at DC) to a range of radio frequencies starting at 'f', while the receiver/detector reverses the process, shifting the band of frequencies starting at 'f' back down to DC.
I've simplified the math somewhat, in particular I haven't talked about how to get LSB by transmitting with a negative frequency -f and demodulating it with +f, but the idea is the same.
https://github.com/threeme3/usdx
Unfortunately, the SSB signal quality is quite poor. There is significant distortion as well as noticeable out-of-band interference.
With my Octave simulation, I’d like to find the reason for this poor quality and improve it if possible.
The simulation is based on the uSDX software.
In my opinion, polar modulation has two advantages. You mentioned one: it allows the use of nonlinear RF amplifiers.
Second, digital signal processing can be performed at the sampling rate of the modulation signal if a VCO (or better yet, an NCO) is used to generate the carrier frequency.
With cartesian modulation, or quadrature mixing, the processing is done either digitally at the carrier frequency’s sampling rate or analogically, requiring a corresponding number of mixers and filters.
The main drawback seems to be poor signal quality — whatever the reason may be?
Back to the beginning of your answer, regarding why the phase differentiator:
Because I (and the uSDX) use an NCO (VCO) for carrier generation. Deriving the phase yields the instantaneous frequency, fm = 1/(2*pi) * δφ/δτ
With fm as the frequency to be modulated, which controls the NCO as a shift of the carrier frequency.
I understand the mathematics behind quadrature mixing, and it produces very clean results in the simulation as well.
That’s not the case with polar modulation using the NCO. I don’t understand the reason for that yet.
I’ll take a look at your Matlab/Octave code; thank you very much for that.
A few notes on the simulation results:
The sampling rate is fs = 6000 Hz.
The carrier frequency is fc = 18000 Hz.
The frequency roll-off in the demodulated signals is due to the LPF decimation filter; I should have sized it better. It has nothing to do with the modulation.
Zusammenstellung_SSB_Simu2c.webp


Polar modulation works for me, you can check the first two Youtube videos at http://www.synthezator.com/ . Most problems are with the phase determination when both arguments are very low - manual intervention is required.
But what do you mean by “manual intervention”?
Do you have a correction algorithm or an approximation when the atan2 arguments are very small?

I spent a lot of time on a correction algorithm for atan2(Xh(t),X(t)) at X(t) close to 0 (or under a noise), and failed so far. It may sound good enough, but artefacts come up in the wrong sideband, when overriding phase manually. For example, for LSB, phase should always decrease. For USB - increase. Also overridden phase must glue nicely with the original phase (over the noise), for radio panorama to show no wrong sideband.
By unwrapping the atan2 before differentiation and carefully aligning the magnitude and phase, I get at least sideband attenuation and interference suppression of about 30dB. Speech sounds pretty decent with this.
But surely an idealized simulation should be able to do better than that!
Do you have spectra of your signal that allow conclusions to be drawn about sideband suppression and interference?
This means the phase and amplitude channels must have closely matched delays. The amplitude channel should also have a significantly larger bandwidth than the actual RF signal to ensure that the unwanted sideband components cancel. How wide is your amplitude channel? For generating communications-quality SSB (2.8 kHz)I would think that a conventional high fidelity audio amplifier (~20 kHz) should be sufficient.
If you have trouble with phase accuracy at low amplitudes, can you just clamp the amplitude to 0?
I don’t understand why the amplitude should have a wider bandwidth than the signal bandwidth. I think this is unnecessary, since the amplitude doesn’t carry any relevant energy beyond that range in my test signals.
I also no longer believe there’s an error in the phase calculation, at least not for the simple 2-tone test signal at 600 Hz/1 kHz. The Q-value in atan2(Q, I) doesn’t take on values < 0.01 here.
This may be different with real audio data.
In any case, I now suspect that the low SNR is an artifact resulting from the interpolation of the signal sampling rate fs to the carrier frequency sampling rate fco.
In the simulation for replicating the NCO, I used the Octave function vco().
The function requires a sampling rate that is at least twice the carrier frequency. I chose 4x 18000 kHz and had to interpolate the modulation signals 12 times. This results in artifacts
ssb_usb = amplitude_i.*vco(deltaphase_i, [(fc-2*fs) (fc+2*fs)], fco)';Here is a time-domain snapshot of amplitude and phase (scaled by 1/2/pi) with a sampling rate of fs=6000 Hz, and in the second image, the interpolated signals amplitude_i and deltaphase_i with a sampling rate of fco=72000 Hz. Here, the amplitude and phase could be aligned in time with slightly greater precision.


Interpolation is probably unnecessary in that case.
Here's why the amplitude channel needs wider bandwidth. Consider frequency modulation (FM); except at very low modulation indices (rates of phase change) it has higher order sidebands that make FM bandwidth greater than AM with the same modulating signal. For a sinusoidal modulating waveform these higher order sidebands are described by Bessel functions.
When you clip your signal and use only the phase, you are generating these extra sidebands; this is how an overdriven amplifier creates splatter. When you re-apply the signal envelope, you must exactly cancel these extra FM sidebands with extra AM sidebands, and so they must be present in the amplitude channel component. That's why its bandwidth must be at least several times greater than the desired RF signal bandwidth. They must also be applied with exactly the right timing.
To understand these artifacts your simulation should introduce intentional, controlled errors in the timing, linearity and bandwith of the reapplied envelope (amplitude) so you can vary them and see the effects. Then you'll know what you really need should you decide to build an actual transmitter using polar modulation.
I don't have the time to dig into this in detail right now, but there's nothing inherently bad with polar modulation. The two channels (phase and envelope) do have to be carefully matched in delay, and the envelope channel should have a bandwidth at least several times the bandwidth of the signal itself. It's also worth looking at predistorting the signal to compensate for nonlinearities in the high level amplification. If you're going to simulate this, you need to account for all the characteristics of the hardware you're simulating.
I still don't understand the need for the phase differentiator. Just convert the phase directly instead of differentiating and then re-integrating it. Depending on the implementation you can just clip the signal to constant amplitude. In software, if you represent the signal as a complex number, the built-in function carg() will give you the phase and cabs() will give you the amplitude. Internally, carg uses the atan2() function, ie, atan2(cimag(x), creal(x)).
So far, it’s just a simulation; there are neither amplifiers nor nonlinearities. Therefore, a better SNR than 30dB should be possible.
In my opinion, it doesn’t matter whether the signals are processed using a complex number or separately as two real numbers (I and Q). The result should be identical.
By the way, the instantaneous frequency determined by differentiation is not reintegrated, but is written directly into the NCO as a control variable.

It's important to know, how the calculated phase is applied on every sample. In my case, AD9959 DDS chip has two modes, configured in registers:
1. RF phase is not reset, so no jumps in RF carrier - I use this method. RF carrier is smooth at the moments of the new phase assignment.
2. RF phase is reset then a new value is applied. This causes intermittent RF phase jump on every sample, which leads to a horrible RF spectrum and bad audio. I tried that and saw results on oscilloscope.
How Octave does that?
Here is an example:
vcotst = vco(d, [(20) (100)], fs);
plot(t(1:1000), vcotst(1:1000),'b');


Nice transition between phases! I also slightly change amplitude, to confirm their synchronization, as many people mentioned here. Receiver should demodulate such RF carrier properly.
To be honest, I control DDS chip by the instantaneous frequency. It changes from sample to sample, staying the same within sample. Phase accumulates linearly within sample. Such RF carrier is demodulated by a standard quadrature detector.






