# Introduction to Systems

## Discrete-Time Integrators

An integrator is a very important filter that proves useful in implementation of many blocks of a communication receiver. In continuous-time case, an integrator finds the area under the curve of a signal amplitude. A discrete-time system deals with just the signal samples and hence a discrete-time integrator serves the purpose of collecting a running sum of past samples for an input signal. Looking at an infinitesimally small scale, this is the same as computing the area under the curve of a signal sampled at an extremely high rate. For the following discussion, we assume a normalized sample time .

For an input and output , there are three main methods to implement a discrete-time integrator.

[Forward difference] The forward difference integrator is realized through the following equation.

(1)

For obvious reasons, the running sum is a common component in all types of integrators; the differentiating factor is the term added to as a replacement for area under the curve. For a forward difference integrator, this additional term is — the current input. This is drawn in Figure below. Notice that the forward difference integrator computes its output after the arrival of the current sample, i.e., at time .

The block diagram shown in the figure is used to implement a forward difference integrator in loop filter portion of a Phase Locked Loop (PLL) that is employed in carrier phase and symbol timing synchronization systems of a digital communication system.

[Backward difference] The backward difference integrator is realized through the following equation.

(2)

Here, the term added to is the previous input . This is also illustrated in the Figure above. In contrast to the forward difference case, the backward difference integrator can compute its output after the last sample, i.e., at time . This minor dissimilarity plays a huge role in analyzing the performance of the actual discrete-time system where the integrator is employed (refer to any DSP text to understand the role of poles and zeros of a system).

The block diagram shown in the figure is used to implement a backward difference integrator in a Numerically Controlled Oscillator (NCO) of a Phase Locked Loop (PLL).

[Average of a backward and forward difference] A third integrator can be implemented as

Why is integrator a lowpass filter?

An integrator maintains a running sum of past samples. In time domain, the summation of a large number of values tends towards a mean value. When some numbers are small, some are large and some are in between, their running sum naturally pulls large variations towards the middle, thus smoothing them out. Large variations represent high frequencies and smoothing out such variations is the function of a lowpass filter.

To verify this fact in frequency domain, first consider that when an impulse is given as input to an integrator in time domain, it again forms a running sum of the impulse, which is a unit step signal. Hence, its impulse response is a unit step signal. The unit step signal is very wide in time domain, so it must be narrow in frequency domain. Consequently, it filters out the high frequency terms and passes only the low frequency content. We can say that it acts as a lowpass filter.

## Moving Average Filter

The most commonly used filter in DSP applications is a moving average filter. In today’s world with extremely fast clock speeds of the microprocessors, it seems strange that an application would require simple operations. But that is exactly the case with most applications in embedded systems that run on limited battery power and consequently host small microcontrollers. For noise reduction, it can be implemented with a few adders and delay elements. For lowpass filtering, the excellent frequency domain response and substantial suppression of stopband sidelobes are less important than having a basic filtering functionality, which is where a moving average filter is most helpful.

As the name implies, a length- moving average filter averages input signal samples to generate one output sample. Mathematically, it can be written as

where as usual, is the input signal, is the system output and is the impulse response of the moving average filter given by

The above discussion leads us to the following observations.

Impulse response From the above equation, the impulse response of a moving average filter can be seen a rectangular pulse which is drawn in Figure below. In terms of filtering, a constant amplitude implies that it treats all input samples with equal significance. This results in a smoothing operation of a noisy input [1].

To see an example of noise reduction in time domain, consider a pulse in Figure below in which random noise is added. Observe that a longer filter performs a better smoothing action on the input signal. However, the longer length translates into wider edges during the transition.

Magnitude response As a consequence of its flat impulse response, the frequency response of a moving average filter is the same as the frequency response of a rectangular pulse, i.e., a sinc signal. The magnitude response of such a filter is drawn in Figure below. It is far from an ideal brickwall response of an ideal lowpass filter but the magnitude response still has a shape that passes low frequencies with some distortion and attenuates high frequencies to some extent.

Due to this insufficient suppression of sidelobes, it is probably the worst lowpass filter one can design. On the other hand, as described earlier, its simplicity of implementation makes it useful for many applications requiring high sample rates including wireless communication systems. In such conditions, a cascade of moving average filters is implemented in series such that each subsequent filter inflicts more suppression to higher frequencies of the input signal.

Due to the inverse relationship between time and frequency domains, a longer filter in time domain produces a narrower frequency response. This can be observed in the impulse and frequency response for filter lengths and .

Phase response As described in the article on FIR filters, a moving average filter generates a delay of samples (for odd ) in the output signal as compared to an input signal. This delay manifests itself in the form of a linear phase in frequency domain.

Convolution Notice from above equations that the filter output is a convolution of the input signal with the impulse response of the moving average filter, a rectangular pulse.

### References

[1] The Scientist and Engineer’s Guide to Digital Signal Processing (1st Edition), California Technical Pub., 1997.

## Finite Impulse Response (FIR) Filters

We learned in the concept of frequency that most signals of practical interest can be considered as a sum of complex sinusoids oscillating at different frequencies. The amplitudes and phases of these sinusoids shape the frequency contents of that signal and are drawn through magnitude response and phase response, respectively. In DSP, a regular goal is to modify these frequency contents of an input signal to obtain a desired representation at the output. This operation is called filtering and it is the most fundamental function in the whole field of DSP.

From this Eq, one can observe that it is possible to design a system, or filter, such that some desired frequency contents of the signal can be passed through by specifying for those values of , while other frequency contents can be suppressed by specifying . The terms lowpass, highpass and bandpass then make intuitive sense that low, high and band refer to desired spectral contents that need to be passed while blocking the rest.

## Filter Frequency Response

Figure below shows the magnitude response (as a function of continuous frequency) of an ideal lowpass filter. A lowpass filter passes frequencies near while blocks the remaining frequencies.

As explained in the discussion about sampling, in a continuous frequency world, the middle filter is all that exists. However, in a sampled world, the frequency response of the filter — just like a sampled signal — repeats at intervals of (sampling frequency) and there are infinite spectral replicas on both sides shown with dashed lines. The primary zone of the sampled frequency response is from to shown within dotted red lines with its spectral contents in solid line. From this Eq on sampling, we know that filter response near is the same as that near and the filter response around is the same as around .

On the other hand, a highpass filter passes both positive and negative frequencies near while blocking everything else. Observe the symmetry around in Figure below. Similarly, bandpass filters only pass a specific portion of the spectrum.

## Filter Impulse Response

Since a filter is a system that modifies the spectral contents of a signal, it naturally has an impulse response just like a system. When this impulse response is finite, the filter is called Finite Impulse Response (FIR). Impulse response of an FIR filter, i.e., the sequence of its coefficients, can be found by taking the iDFT of the frequency response .

## FIR Filter Design

Understanding of FIR filter design starts from the following argument for continuous frequency domain. Since ideal filters have unity passband and zero stopband and a direct transition between these two, this finite frequency domain support produces an impulse response in time domain which is infinite and hence non-realizable, as explained in the discussion about frequency. When this is truncated on the two sides, it is equivalent to multiplication of the ideal infinite by a rectangular window as

As mentioned previously, windowing is a process of pruning an infinite sequence to a finite sequence. We know that multiplication in time domain is convolution in frequency domain, and that the spectrum of a rectangular window is a sinc signal. Thus, convolution between the spectrum of the ideal filter and this sinc signal generates the actual frequency response of the filter.

This sinc signal has decaying oscillations that extend from to . Convolution with these decaying oscillations is the reason why a realizable FIR filter always exhibits ripple in the passband and in the stopband as well as a transition bandwidth between the two. Naturally, this transition bandwidth is equal to the width of the sinc mainlobe, which in turn is a function of the length of the rectangular window in time. Truncation with a rectangular window causes the FIR filters to have an impulse response of finite duration.

Sidelobes appearing in the stopband of the filter, transition bandwidth and ripple in the passband characterize the performance of a filter. These parameters are usually specified in terms of decibels (or dBs). The filter magnitude in dB is given by

It should be remembered that the multiplicative factor above is replaced by for power conversions (because power is a function of voltage or current squared). The advantage of converting magnitudes to dBs for plotting purpose is that very small and very large quantities can be displayed clearly on a single plot.

A filter is designed in accordance with the parameters in Table below and shown graphically in the next Figure.

FIR filter design basically requires finding the values of filter taps (or coefficients) that translate into a desired frequency response. Many software routines are available to accomplish this task. A standard method for FIR filter design is the Parks-McClellan algorithm. The Parks-McClellan algorithm is an iterative algorithm for finding the optimal FIR filter such that the maximum error between the desired frequency response and the actual frequency response is minimized. Filters designed this way exhibit an equiripple behavior in their frequency responses and are sometimes called equiripple filters (equiripple implies equal ripple within the passband and within the stopband, but not necessarily equal in both bands).

Example

We design a lowpass FIR filter through Parks-McClellan algorithm in Matlab that meets the following specifications.

First, noting from above Figure that the maximum amplitude in the passband of frequency domain is , we can convert dB units into linear terms as

For the stopband,

A Matlab function firpm() returns the coefficients of a length linear phase (which implies real and symmetric coefficients, see the concept of phase) FIR filter. For finding an approximate , the Matlab command firpmord() — which stands for FIR Parks-McClellan order — can be used.

where the vector specifies the desired amplitude pointing towards passband and stopband, respectively. For our example,

A word of caution: it can raise confusion in the sense that firpmord() uses the band widths for input amplitudes while firpm() uses the band edges. For example, firpmord() uses the desired amplitude vector to denote passband and stopband. On the other hand, firpm() uses the amplitude vector to denote band edges.

For a trial value of ,

where the vector specifies the desired amplitude at band edges of passband and stopband, respectively. The normalization by is of no significance as it is just a requirement of this function. Furthermore, the filter is designed with coefficients by Matlab and that is why we used as its argument.

If you try this little code, you will see that the result thus obtained had stopband levels of only around dB and a passband ripple of dB. The sidelobes do not meet the dB attenuation while the passband ripple exceeds the requirement of dB. Therefore, can be increased until dB attenuation is achieved for . To avoid excessive filter length increase which increases the processor workload, different weighting factors can be employed for passband and stopband ripples as well. For example, a weighting factor of for passband to stopband ( in vector form) yields,

In this case, the sidelobe level reached dB, a dB improvement over the same when there were no band weights. Next, the filter order is gradually increased until it meets the desired specifications at , a difference of taps from and no weighting factors. Such trial and error approach is often necessary to design a filter with given specifications.

The impulse response and frequency response of the final filter are drawn in Figure below. Note the stopband attenuation of dB and passband ripple within dB.

## Filtering as Convolution

We also learned above that the higher the number of taps, the more closely the filter follows an expected response (e.g., lowpass, highpass, bandpass, etc.) at a cost of increased computational complexity. Therefore, the defining feature of an FIR filter is the number of coefficients that determines the response length, the number of multipliers and the delay in samples required to compute each output. An FIR filter is built of multipliers and adders. A delay element, which is just a clocked register, is used between coefficients. A single delay element is represented with a symbol. Figure below illustrates a 5-tap FIR filter.

Taking into account the structure in Figure above, this -tap filter output can be mathematically written as

For a general FIR filter of length ,

(1)

If this equation sounds familiar to you, you guessed it right. Compare it with convolution Eq, and this is nothing but a convolution between the input signal and the filter coefficients. Just like convolution, at each clock cycle, samples from input data and filter taps are cross-multiplied and the outputs of all multipliers are added to form a single output for that clock cycle. On the next clock cycle, the input data samples are shifted right by relative to filter taps, and the process continues.

## Filter Delay

Due to convolution, the length of the output signal is given as in the article on convolution, which is repeated below.

which is longer than the input by samples. We can say that every FIR filter causes the output signal to be delayed by a number of samples given by

(2)

As a result, samples of the output at the start — when the filter response is moving into the input sequence — can be discarded. Similarly, the last samples — when the filter is moving out of the input sequence — can be discarded as well.

## Filter Phase Response

As discussed in the concept of phase, the phase response of filters is also important because the shape of the signal in time domain is determined by phase alignment of its constituent complex sinusoids. A filter with unity magnitude across the spectrum does not affect the amplitude of those sinusoids but if its phase response is not linear, it can completely change the shape of the filtered signal due to different sinusoids adding up with different phases at the output. A linear phase on the other hand just delays the output without distorting it. In the post on convolution, we discussed that the output response of an LTI system to a complex sinusoid at its input is nothing but the same complex sinusoid at the same frequency but with different amplitude and phase. If this phase of the filter is a linear function of frequency , then rearranging Eq on time and phase shifts,

for all complex sinusoids in its spectrum. Fortunately, maintaining a linear phase response in FIR filters is straightforward by making the coefficients symmetric, see this Figure as an example. This is one of the main reasons for widespread use of FIR filters in DSP applications.

## What is a System?

In wireless communications and other applications of digital signal processing, we often want to modify a generated or acquired signal. A device or algorithm that performs some prescribed operations on an input signal to generate an output signal is called a system.

In a previous article about transforming a signal, we saw how a signal can be scaled and time shifted, or added and multiplied with another signal. These are all examples of a system. Our main focus in these articles will be on a particular class of systems which are linear and time-invariant.

## Additive White Gaussian Noise (AWGN)

The performance of a digital communication system is quantified by the probability of bit detection errors in the presence of thermal noise. In the context of wireless communications, the main source of thermal noise is addition of random signals arising from the vibration of atoms in the receiver electronics.

It is called additive white Gaussian noise (AWGN) due to the following reasons:

[Additive] The noise is additive, i.e., the received signal is equal to the transmitted signal plus noise. This gives the most widely used equality in communication systems.

(1)

and is shown in Figure below. Remember that the above equation is highly simplified due to neglecting every single imperfection a Tx signal encounters, except the noise itself.

Moreover, this noise is statistically independent of the signal.

[White] Just like the white color which is composed of all frequencies in the visible spectrum, white noise refers to the idea that it has uniform power across the whole frequency band. As a consequence, the spectral density of white noise is ideally flat for all frequencies ranging from to .

[Gaussian] The probability distribution of the noise samples is Gaussian, i.e., in time domain, the samples can acquire both positive and negative values and in addition, the values close to zero have a higher chance of occurrence while the values far away from zero are less likely to appear. This is shown in Figure below.

As a result, the time domain average of a large number of noise samples is zero. We will use this attribute over and over again throughout the system design.

Nyquist investigated the properties of thermal noise and showed that its power spectral density is equal to , where is a constant and is the temperature in Kelvin. As a consequence, the noise power is directly proportional to the equivalent temperature and hence the name thermal noise. Historically, this constant value indicated in noise spectral density Figure is denoted as Watts/Hz.

When we view the constant spectral density as a rectangular sequence (we do not discuss random sequences here, so this discussion is just for a general understanding), its iDFT must be a unit impulse. Furthermore, in the article on correlation, we saw that the iDFT of the spectral density is the auto-correlation function of the signal. Combining these two facts, an implication of a constant spectral density is that the autocorrelation of the noise in time domain is a unit impulse, i.e., it is zero for all non-zero time shifts.

In words, each noise sample in a sequence is uncorrelated with every other noise sample in the same sequence.

In reality, the ideal flat spectrum from to is true for frequencies of interest in wireless communications (a few kHz to hundreds of GHz) but not for higher frequencies. Nevertheless, every wireless communication system involves filtering that removes most of the noise energy outside the spectral band occupied by our desired signal. Consequently after filtering, it is not possible to distinguish whether the spectrum was ideally flat or partially flat outside the band of interest. To help in mathematical analysis of the underlying waveforms resulting in closed-form expressions — a holy grail of communication theory — it can be assumed flat before filtering as shown in noise spectral density Figure.

For a discrete signal with sampling rate , the sampling theorem dictates that the bandwidth is constrained by an above mentioned lowpass filter within the range to avoid aliasing. This filter is an ideal lowpass filter with

The resulting in-band power is shown in red in Figure below, while the rest is filtered out.

As with all densities, the value is the amount of noise power per unit bandwidth .

(2)

Plugging in the above equation, the noise power in a sampled bandlimited system is given as

(3)

Thus, the noise power is directly proportional to the system bandwidth at the sampling stage.

Fooling the Randomness

As we will see in our discussions about communication systems, a communication signal has a lot of structure in its construction. However, due to Gaussian nature of noise acquiring both positive and negative values, the result of adding a large number of noise-only samples tends to zero.

Therefore, when a noisy signal is received, the Rx exploits this structure through correlating with what is expected. In the process, it estimates various unknown parameters and detects the actual message while averaging over a large number of observations. This correlation brings order out and averaging mitigates the harsh effects of noise.

An AWGN channel is the most basic model of a communication system. Even simple practical systems suffer from various kinds of imperfections in addition to AWGN. Examples of systems operating largely in AWGN conditions are space communications with highly directional antennas and some point-to-point microwave links.