# 5.17: Digital Signal Processing Problems

- Page ID
- 1839

- Practice problems.

## Sampling and Filtering=?

The signal **s(t)** is bandlimited to 4 kHz. We want to sample it, but it has been subjected to various signal processing manipulations.

- What sampling frequency (if any works) can be used to sample the result of passing
**s(t)**through an RC highpass filter with**R = 10kΩ**and**C = 8nF**? - What sampling frequency (if any works) can be used to sample the
**derivative**of**s(t)**? - The signal
**s(t)**has been modulated by an 8 kHz sinusoid having an unknown phase: the resulting signal is \[s(t)\sin (2\pi f_{0}t+\varphi ) \nonumber \] with**f**_{0}**= 8kHz**and**φ=?**Can the modulated signal be sampled so that the**original**signal can be recovered from the modulated signal regardless of the phase value**φ**? If so, show how and find the smallest sampling rate that can be used; if not, show why not.

## Non-Standard Sampling

Using the properties of the Fourier series can ease finding a signal's spectrum.

- Suppose a signal
**s(t)**is periodic with period**T**. If**c**represents the signal's Fourier series coefficients, what are the Fourier series coefficients of \[s\left ( t-\frac{T}{2} \right ) \nonumber \]_{k} - Find the Fourier series of the signal
**p(t)**shown in the Figure 5.17.1. - Suppose this signal is used to sample a signal bandlimited to
**1/T Hz**. Find an expression for and sketch the spectrum of the sampled signal. - Does aliasing occur? If so, can a change in sampling rate prevent aliasing; if not, show how the signal can be recovered from these samples.

## A Different Sampling Scheme

A signal processing engineer from Texas A&M claims to have developed an improved sampling scheme. He multiplies the bandlimited signal by the depicted periodic pulse signal to perform sampling.

- Find the Fourier spectrum of this signal.
- Will this scheme work? If so, how should
**T**be related to the signal's bandwidth? If not, why not?_{S}

## Bandpass Sampling

The signal **s(t) **has the indicated spectrum.

- What is the minimum sampling rate for this signal suggested by the Sampling Theorem?
- Because of the particular structure of this spectrum, one wonders whether a lower sampling rate could be used. Show that this is indeed the case, and find the system that reconstructs
**s(t)**from its samples.

## Sampling Signals

If a signal is bandlimited to **W** **Hz**, we can sample it at any rate

\[\frac{1}{T_{S}}> 2W \nonumber \]

and recover the waveform exactly. This statement of the Sampling Theorem can be taken to mean that all information about the original signal can be extracted from the samples. While true in principle, you do have to be careful how you do so. In addition to the rms value of a signal, an important aspect of a signal is its peak value, which equals

\[\max \left \{ \left | s(t) \right | \right \} \nonumber \]

- Let
**s(t)**be a sinusoid having frequency**W****Hz**. If we sample it at precisely the Nyquist rate, how accurately do the samples convey the sinusoid's amplitude? In other words, find the worst case example. - How fast would you need to sample for the amplitude estimate to be within 5% of the true value?
- Another issue in sampling is the inherent amplitude quantization produced by A/D converters. Assume the maximum voltage allowed by the converter is
**V**volts and that it quantizes amplitudes to_{max}**b**bits. We can express the quantized sample \[Q(s(nT_{S}))\; as\; s(nT_{S})+\varepsilon (t) \nonumber \] where**ε(t)**represents the quantization error at the**n**sample. Assuming the converter rounds, how large is maximum quantization error?^{th} - We can describe the quantization error as noise, with a power proportional to the square of the maximum error. What is the signal-to-noise ratio of the quantization error for a full-range sinusoid? Express your result in decibels.

## Hardware Error

An A/D converter has a curious hardware problem: Every other sampling pulse is half its normal amplitude.

- Find the Fourier series for this signal.
- Can this signal be used to sample a bandlimited signal having highest frequency \[W=\frac{1}{2T} \nonumber \]

## Simple D/A Converter

Commercial digital-to-analog converters don't work this way, but a simple circuit illustrates how they work. Let's assume we have a **B**-bit converter. Thus, we want to convert numbers having a **B**-bit representation into a voltage proportional to that number. The first step taken by our simple converter is to represent the number by a sequence of **B **pulses occurring at multiples of a time interval **T**. The presence of a pulse indicates a “1” in the corresponding bit position, and pulse absence means a “0” occurred. For a 4-bit converter, the number 13 has the binary representation 1101

\[13_{10}=1\times 2^{3}+1\times 2^{2}+0\times 2^{1}+1\times 2^{0} \nonumber \]

and would be represented by the depicted pulse sequence. Note that the pulse sequence is “backwards” from the binary representation. We'll see why that is.

This signal serves as the input to a first-order RC lowpass filter. We want to design the filter and the parameters **Δ** and **T **so that the output voltage at time **4T **(for a 4-bit converter) is proportional to the number. This combination of pulse creation and filtering constitutes our simple D/A converter. The requirements are

- The voltage at time
**t = 4T**should diminish by a factor of**2**the further the pulse occurs from this time. In other words, the voltage due to a pulse at**3T**should be twice that of a pulse produced at**2T**, which in turn is twice that of a pulse at**T**, etc. - The 4-bit D/A converter must support a 10 kHz sampling rate.

- Show the circuit that works. How do the converter's parameters change with sampling rate and number of bits in the converter?

## Discrete-Time Fourier Transforms

Find the Fourier transforms of the following sequences, where **s(n)** is some sequence having Fourier transform \[S(e^{i2\pi f}) \nonumber \]

- \[(-1)^{n}s(n) \nonumber \]
- \[s(n)\cos (2\pi f_{0}n) \nonumber \]
- \[x(n)=\begin{cases} s(\frac{n}{2}) & \text{ if } n\; even \\ 0 & \text{ if } n\; odd \end{cases} \nonumber \]
- \[ns(n) \nonumber \]

## Spectra of Finite-Duration Signals

Find the indicated spectra for the following signals.

- The discrete-time Fourier transform of \[s(n)=\begin{cases} \cos ^{2} \left ( \frac{\pi }{4} n\right )& \text{ if } n= \left \{ -1,0,1 \right \}\\ 0 & \text{ if } otherwise \end{cases} \nonumber \]
- The discrete-time Fourier transform of \[s(n)=\begin{cases} n & \text{ if } n= \left \{ -2,-1,0,1,2 \right \}\\ 0 & \text{ if } otherwise \end{cases} \nonumber \]
- The discrete-time Fourier transform of \[s(n)=\begin{cases} \sin \left ( \frac{\pi }{4} n\right ) & \text{ if } n= \left \{ 0,...,7 \right \}\\ 0 & \text{ if } otherwise \end{cases} \nonumber \]
- The length-8 DFT of the previous signal.

## Just Whistlin'

Sammy loves to whistle and decides to record and analyze his whistling in lab. He is a very good whistler; his whistle is a pure sinusoid that can be described by

\[s_{a}(t)=\sin (4000t) \nonumber \]

To analyze the spectrum, he samples his recorded whistle with a sampling interval of

\[T_{S}=2.5\times 10^{-4} \nonumber \]

to obtain

\[s(n)=s_{a}(nT_{S}) \nonumber \]

Sammy (wisely) decides to analyze a few samples at a time, so he grabs 30 consecutive, but arbitrarily chosen, samples. He calls this sequence **x(n)** and realizes he can write it as

\[x(n)=\sin (4000nT_{s}+\theta ),\; n=\left \{ 0,...,29 \right \} \nonumber \]

- Did Sammy under- or over-sample his whistle?
- What is the discrete-time Fourier transform of
**x(n)**and how does it depend on**θ**? -
How does the 32-point DFT of
**x(n)**depend on**θ**?

## Discrete-Time Filtering

We can find the input-output relation for a discrete-time filter much more easily than for analog filters. The key idea is that a sequence can be written as a weighted linear combination of unit samples.

- Show that \[x(n)=\sum _{i}x(i)\delta (n-i) \nonumber \] where
**δ(n)**is the unit-sample. \[\delta (n)=\begin{cases} 1 & \text{ if } n=0 \\ 0 & \text{ if } otherwise \end{cases} \nonumber \] - If
**h(n)**denotes the**unit-sample response**—the output of a discrete-time linear, shift-invariant filter to a unit-sample input—find an expression for the output. - In particular, assume our filter is FIR, with the unit-sample response having duration
**q+1**. If the input has duration**N**, what is the duration of the filter's output to this signal? - Let the filter be a boxcar averager: \[h(n)=\frac{1}{q+1}\; for\; n=\left \{ 0,...,q \right \} \nonumber \] and zero otherwise. Let the input be a pulse of unit height and duration
**N.**Find the filter's output when \[N=\frac{q+1}{2} \nonumber \]**q**an odd integer.

## A Digital Filter

A digital filter has the depicted unit-sample reponse.

- What is the difference equation that defines this filter's input-output relationship?
- What is this filter's transfer function?
- What is the filter's output when the input is \[\sin \left ( \frac{\pi n}{4} \right ) \nonumber \]

## A Special Discrete-Time Filter

Consider a FIR filter governed by the difference equation

\[y(n)=\frac{1}{3}x(n+2)+\frac{2}{3}x(n+1)+x(n)+\frac{2}{3}x(n-1)+\frac{1}{3}x(n-2) \nonumber \]

- Find this filter's unit-sample response.
- Find this filter's transfer function. Characterize this transfer function (i.e., what classic filter category does it fall into).
- Suppose we take a sequence and stretch it out by a factor of three. \[x(n)=\begin{cases} s(\frac{n}{3}) & \text{ if } \forall m,m=\left \{ ...,-1,0,1,... \right \} :(n-3m)\\ 0 & \text{ if } otherwise \end{cases} \nonumber \]
- Sketch the sequence
**x(n)**for some example**s(n).** - What is the filter's output to this input?
- In particular, what is the output at the indices where the input
**x(n)**is intentionally zero? - Now how would you characterize this system?

- Sketch the sequence

## Simulating the Real World

Much of physics is governed by differntial equations, and we want to use signal processing methods to simulate physical problems. The idea is to replace the derivative with a discrete-time approximation and solve the resulting differential equation. For example, suppose we have the differential equation

\[\frac{\mathrm{d} y(t)}{\mathrm{d} t}+ay(t)=x(t) \nonumber \]

and we approximate the derivative by

\[\frac{\mathrm{d} y(t)}{\mathrm{d} t}\mid\ _{t=nT}\simeq \frac{y(nT)-y((n-1)T)}{T} \nonumber \]

where **T **essentially amounts to a sampling interval.

- What is the difference equation that must be solved to approximate the differential equation?
- When
**x(t) = u(t)**, the unit step, what will be the simulated output? - Assuming
**x(t)**is a sinusoid, how should the sampling interval**T**be chosen so that the approximation works well?

## Derivatives

The derivative of a sequence makes little sense, but still, we can approximate it. The digital filter described by the difference equation

\[y(n)=x(n)-x(n-1) \nonumber \]

resembles the derivative formula. We want to explore how well it works.

- What is this filter's transfer function?
- What is the filter's output to the depicted triangle output?

- Suppose the signal
**x(n)**is a sampled analog signal: \[x(n)=x(nT_{S}) \nonumber \] Under what conditions will the filter act like a differentiator? In other words, when will**y(n)**be proportional to \[\frac{\mathrm{d} x(t)}{\mathrm{d} t}\mid\ _{t=nT_{S}} \nonumber \]

## The DFT

Let's explore the DFT and its properties.

- What is the length-
**K**DFT of length-**N**boxcar sequence, where**N < K?** - Consider the special case where
**K = 4**. Find the inverse DFT of the product of the DFTs of two length-3 boxcars. - If we could use DFTs to perform linear filtering, it should be true that the product of the input's DFT and the unit-sample response's DFT equals the output's DFT. So that you can use what you just calculated, let the input be a boxcar signal and the unit-sample response also be a boxcar. The result of part (b) would then be the filter's output
**if**we could implement the filter with length-4 DFTs. Does the actual output of the boxcar-filter equal the result found in the previous part? - What would you need to change so that the product of the DFTs of the input and unit-sample response in this case equaled the DFT of the filtered output?

## DSP Tricks

Sammy is faced with computing **lots** of discrete Fourier transforms. He will, of course, use the FFT algorithm, but he is behind schedule and needs to get his results as quickly as possible. He gets the idea of computing **two** transforms at one time by computing the transform of \[s(n)=s_{1}(n)+is_{2}(n) \nonumber \] where **s _{1}(n) and s_{2}(n) **are two real-valued signals of which he needs to compute the spectra. The issue is whether he can retrieve the individual DFTs from the result or not.

- What will be the DFT
**S(k)**of this complex-valued signal in terms of**S**the DFTs of the original signals?_{1}(k) and S_{2}(k), - Sammy's friend, an Aggie who knows some signal processing, says that retrieving the wanted DFTs is easy: “Just find the real and imaginary parts of
**S(k)**.” Show that this approach is too simplistic. - While his friend's idea is not correct, it does give him an idea. What approach will work?
**Hint**: Use the symmetry properties of the DFT. - How does the number of computations change with this approach? Will Sammy's idea ultimately lead to a faster computation of the required DFTs?

## Discrete Cosine Transform (DCT)

The discrete cosine transform of a length-**N **sequence is defined to be

\[S_{c}(k)=\sum_{n=0}^{N-1}s(n)\cos \left ( \frac{2\pi nk}{2N} \right ) \nonumber \]

Note that the number of frequency terms is \[2N-1:k=\left \{ 0,...,2N-1 \right \} \nonumber \]

- Find the inverse DCT.
- Does a Parseval's Theorem hold for the DCT?
- You choose to transmit information about the signal
**s(n)**according to the DCT coefficients. You could only send one, which one would you send?

## A Digital Filter

A digital filter is described by the following difference equation:

\[y(n)=ay(n-1)+ax(n)-x(n-1),a=\frac{1}{\sqrt{2}} \nonumber \]

- What is this filter's unit sample response?
- What is this filter's transfer function?
- What is this filter's output when the input is \[\sin \left ( \frac{\pi n}{4} \right ) \nonumber \]

## Another Digital Filter

A digital filter is determined by the following difference equation.

\[y(n)=y(n-1)+x(n)-x(n-4) \nonumber \]

- Find this filter's unit sample response.
- What is the filter's transfer function? How would you characterize this filter (lowpass, highpass, special purpose, ...)?
- Find the filter's output when the input is the sinusoid \[\sin \left ( \frac{\pi n}{2} \right ) \nonumber \]
- In another case, the input sequence is zero for
**n < 0,**then becomes nonzero. Sammy measures the output to be \[y(n)=\delta (n)+\delta (n-1) \nonumber \] Can his measurement be correct? In other words, is there an input that can yield this output? If so, find the input**x(n)**that gives rise to this output. If not, why not?

## Yet Another Digital Filter

A filter has an input-output relationship given by the difference equation

\[y(n)=\frac{1}{4}x(n)+\frac{1}{2}x(n-1)+\frac{1}{4}x(n-2) \nonumber \]

- What is the filter's transfer function? How would you characterize it?
- What is the filter's output when the input equals \[\cos \left ( \frac{\pi n}{2} \right ) \nonumber \]
- What is the filter's output when the input is the depicted discrete-time square wave below?

## A Digital Filter in the Frequency Domain

We have a filter with the transfer function

\[H(e^{i2\pi f})=e^{-(i2\pi f)}\cos (2\pi f) \nonumber \]

operating on the input signal

\[x(n)=\delta (n)-\delta (n-2) \nonumber \]

that yields the output **y(n)**.

- What is the filter's unit-sample response?
- What is the discrete-Fourier transform of the output?
- What is the time-domain expression for the output?

## Digital Filters

A discrete-time system is governed by the difference equation

\[y(n)=y(n-1)+\frac{x(n)+x(n-1)}{2} \nonumber \]

- Find the transfer function for this system.
- What is this system's output when the input is \[\sin \left ( \frac{\pi n}{2}\right ) \nonumber \]
- If the output is observed to be \[y(n)=\delta (n)+\delta (n-1) \nonumber \] then what is the input?

## Digital Filtering

A digital filter has an input-output relationship expressed by the difference equation

\[y(n)=\frac{x(n)+x(n-1)+x(n-2)+x(n-3)}{4} \nonumber \]

- Plot the magnitude and phase of this filter's transfer function.
- What is this filter's output when \[x(n)=cos \left ( \frac{\pi n}{2}\right )+2sin \left ( \frac{2\pi n}{3}\right ) \nonumber \]

## Detective Work

- The signal \[x(n)=\delta (n)-\delta (n-1) \nonumber \]
- Find the length-8 DFT (discrete Fourier transform) of this signal.
- You are told that when
**x(n)**served as the input to a linear FIR (finite impulse response) filter, the output was \[y(n)=\delta (n)-\delta (n-1)+2\delta (n-2) \nonumber \] Is this statement true? If so, indicate why and find the system's unit sample response; if not, show why not.

- A discrete-time, shift invariant, linear system produces an output \[y(n)=\left \{ 1,-1,0,0,... \right \} \nonumber \] when its input
**x(n)**equals a unit sample.- Find the difference equation governing the system.
- Find the output when \[x(n)=\cos (2\pi f_{0}n) \nonumber \]
- How would you describe this system's function?

## Time Reversal has Uses

A discrete-time system has transfer function \[H(e^{i2\pi f}) \nonumber \] A signal **x(n) **is passed through this system to yield the signal **w(n)**. The time-reversed signal **w(-n) **is then passed through the system to yield the time-reversed output **y(-n)**. What is the transfer function between **x(n) **and** y(n)**?

## Removing “Hum”

The slang word “hum” represents power line waveforms that creep into signals because of poor circuit construction. Usually, the 60 Hz signal (and its harmonics) are added to the desired signal. What we seek are filters that can remove hum. In this problem, the signal and the accompanying hum have been sampled; we want to design a **digital** filter for hum removal.

- Find filter coefficients for the length-3 FIR filter that can remove a sinusoid having
**digital**frequency**f**from its input._{0} - Assuming the sampling rate is
**f**to what analog frequency does_{s}**f**_{0 }correspond? - A more general approach is to design a filter having a frequency response
**magnitude**proportional to the absolute value of a cosine: \[\left | H(e^{i2\pi f}) \right |\propto \left | \cos (\pi fN) \right | \nonumber \] In this way, not only can the fundamental but also its first few harmonics be removed. Select the parameter**N**and the sampling rate so that the frequencies at which the cosine equals zero correspond to 60 Hz and its odd harmonics through the fifth. - Find the difference equation that defines this filter.

## Digital AM Receiver

Thinking that digital implementations are **always** better, our clever engineer wants to design a digital AM receiver. The receiver would bandpass the received signal, pass the result through an A/D converter, perform all the demodulation with digital signal processing systems, and end with a D/A converter to produce the analog message signal. Assume in this problem that the carrier frequency is always a large **even** multiple of the message signal's bandwidth **W**.

- What is the smallest sampling rate that would be needed?
- Show the block diagram of the least complex digital AM receiver.
- Assuming the channel adds white noise and that a
**b**-bit A/D converter is used, what is the output's signal-to-noise ratio?

## DFTs

A problem on Samantha's homework asks for the **8-point** DFT of the discrete-time signal \[\delta (n-1)+\delta (n-7) \nonumber \]

- What answer should Samantha obtain?
- As a check, her group partner Sammy says that he computed the inverse DFT of her answer and got \[\delta (n+1)+\delta (n-1) \nonumber \] Does Sammy's result mean that Samantha's answer is wrong?
- The homework problem says to lowpass-filter the sequence by multiplying its DFT by \[H(k)=\begin{cases} 1 & \text{ if }k=\left \{ 0,1,7 \right \} \\ 0 & \text{ if } otherwise \end{cases} \nonumber \] and then computing the inverse DFT. Will this filtering algorithm work? If so, find the filtered output; if not, why not?

## Stock Market Data Processing

Because a trading week lasts five days, stock markets frequently compute running averages each day over the previous five trading days to smooth price fluctuations. The technical stock analyst at the Buy-Lo--Sell-Hi brokerage firm has heard that FFT filtering techniques work better than any others (in terms of producing more accurate averages).

- What is the difference equation governing the five-day averager for daily stock prices?
- Design an efficient FFT-based filtering algorithm for the broker. How much data should be processed at once to produce an efficient algorithm? What length transform should be used?
- Is the analyst's information correct that FFT techniques produce more accurate averages than any others? Why or why not?

## Echoes

Echoes not only occur in canyons, but also in auditoriums and telephone circuits. In one situation where the echoed signal has been sampled, the input signal **x(n) **emerges as

\[x(n)+a_{1}x(n-n_{1})+a_{2}x(n-n_{2}) \nonumber \]

- Find the difference equation of the system that models the production of echoes.
- To simulate this echo system, ELEC 241 students are asked to write the most efficient (quickest) program that has the same input-output relationship. Suppose the duration of
**x(n)**is 1,000 and that \[a_{1}=\frac{1}{2},n_{1}=10,a_{2}=\frac{1}{5},n_{2}=25 \nonumber \] Half the class votes to just program the difference equation while the other half votes to program a frequency domain approach that exploits the speed of the FFT. Because of the undecided vote, you must break the tie. Which approach is more efficient and why? - Find the transfer function and difference equation of the system that suppresses the echoes. In other words, with the echoed signal as the input, what system's output is the signal
**x(n)**?

## Digital Filtering of Analog Signals

RU Electronics wants to develop a filter that would be used in analog applications, but that is implemented digitally. The filter is to operate on signals that have a 10 kHz bandwidth, and will serve as a lowpass filter.

- What is the block diagram for your filter implementation? Explicitly denote which components are analog, which are digital (a computer performs the task), and which interface between analog and digital worlds.
- What sampling rate must be used and how many bits must be used in the A/D converter for the acquired signal's signal-to-noise ratio to be at least 60 dB? For this calculation, assume the signal is a sinusoid.
- If the filter is a length-128 FIR filter (the duration of the filter's unit-sample response equals 128), should it be implemented in the time or frequency domain?
- Assuming \[H(e^{i2\pi f}) \nonumber \] is the transfer function of the digital filter, what is the transfer function of your system?

## Signal Compression

Because of the slowness of the Internet, lossy signal compression becomes important if you want signals to be received quickly. An enterprising 241 student has proposed a scheme based on frequency-domain processing. First of all, he would section the signal into length-**N **blocks, and compute its **N**-point DFT. He then would discard (zero the spectrum) at **half** of the frequencies, quantize them to **b**-bits, and send these over the network. The receiver would assemble the transmitted spectrum and compute the inverse DFT, thus reconstituting an **N**-point block.

- At what frequencies should the spectrum be zeroed to minimize the error in this lossy compression scheme?
- The nominal way to represent a signal digitally is to use simple
**b**-bit quantization of the time-domain waveform. How long should a section be in the proposed scheme so that the required number of bits/sample is smaller than that nominally required? - Assuming that effective compression can be achieved, would the proposed scheme yield satisfactory results?