Digital Baseband Transmission and Frequency-Domain Analysis

A curve that tests the chain

The theoretical bit error rate of a baseband link assumes three things: the receiver's filter is matched to the transmitted pulse, each sample is taken at the instant the combined response peaks, and neighboring symbols contribute nothing at that instant. A simulated link that gets all three right lands on the theoretical curve. A link that satisfies none of them can still draw a plausible curve of its own, only shifted away from theory. So when measurement and theory coincide, the result is not merely a pleasing figure; it is a check on every stage that produced it.

A log-scale plot of bit error rate against signal-to-noise ratio from 0 to 9 dB. The simulated curve and the theoretical curve lie on top of one another, falling from about 8 in 100 to about 3 in 100,000.
The measured bit error rate lies on the theoretical curve across the whole range of signal-to-noise ratios, each point a long run of symbols through the complete chain.

That figure is where the first of two MATLAB studies I carried out in 2024 ends up. The studies share one subject: what happens to a signal between its source and the decision made about it. The first builds a complete baseband link, from source and pulse shaping through an additive noise channel, a matched filter and sampling to a threshold decision, and measures its error rate against theory. The second goes underneath the link, to the discrete Fourier transform written from its definition and to what a sampling rate does to a spectrum.

Every stage written by hand

A toolbox can simulate a baseband link in a few calls: one function shapes the pulse, one adds noise, one detects, one counts the errors. I wrote every stage from primitives instead, and the whole study rests on that decision. A toolbox call is correct by assumption. A stage I wrote is correct only if its output agrees with what theory predicts, which is what turns the final curve into evidence.

Writing each stage also puts the design choices in plain sight: how far to upsample, how long the filter is, where its start-up and tail transients are trimmed, which sample in each symbol period the detector reads, and which way a tie at the threshold goes. Each of these moves the measured curve if it is made wrong.

The link starts with a long random source. The symbols are line-coded and then upsampled, so each one becomes a single impulse followed by a run of zeros, and the shaping filter turns that impulse train into a waveform.

Three stem plots: the source symbol stream, the line-coded stream, and the same stream after twenty-times upsampling, which spreads thirty symbols across six hundred samples.
The source symbols, their line code, and the same stream upsampled into a train of impulses.

A rectangle or a roll-off

I built the link twice, once with each of two shaping filters, because comparing them is the point of the study.

The first is the ideal low-pass filter. It is a rectangle in frequency, which makes it a sinc in time: infinitely long, ringing on both sides of every symbol. The second is a root raised cosine. It gives up some bandwidth in exchange for a pulse that dies out quickly, and that trade is the whole difference between the two.

Three panels: the root raised cosine impulse response as a stem plot, the ideal low-pass filter impulse response as a sinc, and the frequency response of both, the ideal one a rectangle out to 20 Hz and the raised cosine rolling off around it.
The two shaping filters in time and in frequency, where the rectangle costs nothing in bandwidth and everything in time.

Passing the same source through both, with and without noise, shows what that trade looks like on the wire. Through the ideal filter, the waveform carries the tails of neighboring symbols. Through the root raised cosine, those tails have died away by the time the next symbol is sampled.

Four waveform panels: the original baseband through the ideal low-pass filter, the noisy signal through it, the original through the raised cosine filter, and the noisy signal through it.
The same stretch of signal through each filter, both clean and with noise added.

At the receiver

The receiver passes the signal through the same root raised cosine again. Two of them in series form one raised cosine, which is zero at every symbol instant except its own. A single pair of filters therefore serves both as the matched filter and as the condition for zero intersymbol interference. The output is sampled once per symbol period, each sample is compared with a threshold, and the decision is mapped back to a source symbol.

Three stem plots: the sampled signal with values spread around plus and minus one, the same after the threshold decision, and the decoded symbol stream.
Sample, decide and decode, where the spread in the first panel is the noise the decision has to absorb.

Where in each symbol to take that sample is a question of its own, and the eye diagram answers it. Overlaying the received waveform one symbol period at a time collapses the whole stream into a single picture. The vertical opening at the decision instant is the threshold's margin against noise, and the horizontal opening is how far the sampling instant can drift before neighboring symbols start to interfere.

The two filters separate as sharply here as they do in the waveforms. The sinc tails of the ideal filter run through the decision region and close the eye. The root raised cosine pair, zero at every symbol instant but its own, keeps the crossings bunched and the eye open. I formed the eye for both filters and used it to place the sampling instant and to read how much timing error the link tolerates.

Then the whole chain runs again at a series of signal-to-noise ratios, and the measured error rate is plotted against the analytic one. The two curves lie on top of each other across the full range. A wrong filter length, a sampler off by one, or a threshold on the wrong side would pull the measured curve away from theory, and it does not move. Each point uses a very long run of symbols, because at the low-error end the rate is so small that a short run could not resolve it, and the comparison would mean nothing.

Underneath: the transform

The second study starts one level down, with the transform itself. I wrote the DFT as its defining sum over the sequence and the inverse DFT as the matching sum back, and ran both against MATLAB's built-in transforms on the same input. Rebuilding the sequence from its own spectrum and getting the original back is what shows the pair is right.

Three stem plots: a random sequence of thirty-one samples, its DFT magnitude spectrum, and the sequence reconstructed from the IDFT, identical to the original.
A random sequence, its magnitude spectrum, and the same sequence recovered from that spectrum.

One tone, three sampling rates

With the transform in hand, I sampled a single sinusoid at three rates and took each result back to the frequency domain.

Sampled at more than twice its frequency, the tone appears in the spectrum where it belongs. Sampled at a rate between once and twice its frequency, it folds down to a lower frequency that was never in the signal. Sampled at exactly its own frequency, every sample lands at the same point of the cycle, and the sampled sequence is a constant with no tone left in it at all.

Four panels: a continuous 20 Hz sinusoid, then the same signal sampled at 20 Hz, at 30 Hz and at 80 Hz. Three magnitude spectra of the sampled sequences: numerically zero at 20 Hz, peaks at 10 and 20 Hz at 30 Hz, and peaks at 20 and 60 Hz at 80 Hz.
One signal at three sampling rates (left) and the same three cases in the frequency domain (right), where the aliased peak is the sampling theorem stated as a picture.