# Practical Applications in Digital Signal Processing: Review of Digital Frequency

This chapter is from the book

## 1.2. Defining Digital Frequencies

Unlike an analog frequency, a digitally generated frequency does not have infinite resolution. A digital frequency can only take on discrete values. A digital sine wave, for example, can only take on discrete values for frequency, phase, and amplitude. For the purposes of this chapter, the frequency resolution of a digitally generated sinusoid is limited by the period of the digital sample clock T = 1/fS, and the precision of the sinusoidal waveform amplitude is limited by the bit width of each digital sample. Let us begin our discussion by considering a digital sinusoidal waveform.

We know that a sine wave has unity amplitude and is repetitive every 2π radians. As illustrated in Figure 1.1, we can draw a circle of radius 1, called the unit circle, and we can visualize a phasor of unity magnitude rotating around the unit circle at some fixed angular rate ωK. Every time the phasor makes a complete revolution around the unit circle, it has passed through 2π radians and has completed one cycle. We quantify the phasor’s rotational speed as being ωK radians per second. To get started, let us assign the label C to this phasor. Since the phasor C takes on values only at discrete instances of the sample period T, we can represent it as a function of discrete time by writing C(nT) {for n = 0, 1, 2, ...}.

We can use some simple trigonometry to represent the phasor C(nT) by its vertical and horizontal components, labeled A(nT) and B(nT) in Figure 1.1. The magnitude of C is related to the value of its components by the Pythagorean theorem: .

We can see that as the phasor C rotates around the unit circle, the magnitude of the A component cyclically grows from 0 at 0 radians to +1 at π/2 radians. It then attenuates back to 0 at π radians, grows to –1 at 3π/2 radians, and finally attenuates back to a value of 0 as the phasor passes through 2π radians. Each time the phasor completes a rotation of 2π radians, the amplitude of the A component traces out a sine wave and the amplitude of the B component traces out a cosine wave, as illustrated in Figure 1.1.

Since we are dealing with a digital system, we know that the values of the phasor components A, B, and C, and the phasor phase angle θ, shown in Figure 1.1, take on values only at discrete instants of time equal to the period of the sample frequency, or T = 1/fS. Sequential sampling instants can be represented by the infinite series

• 1T, 2T, 3T, ···, nT, ···

We can represent any arbitrary sampling instant as nT for 0 ≤ n ≤ ∞. Incorporating this notation into the unit circle phasor representation Figure 1.1, we see that the only values that can be represented by the phasor C, its vertical and horizontal components A and B, and the phase angle θ are at the instants of time equal to nT. We know from trigonometry that

and

We also know that since we are working on the unit circle, the magnitude of . Therefore we can state that at any sampling instant nT,

and

Equation 1.1

So far so good, but how do we quantify the discrete values taken on by the sinusoidal waveforms? Well, we can start by dividing the unit circle into N equal arc segments, illustrated by the black dots on the unit circle in Figure 1.1. Each arch segment is a portion of the unit circle scribed by the tip of the phasor C as the phase angle θ is incremented by 2π/N radians.

We will take this opportunity to coin a new and highly technical term. Let us define the angle 2π/N and the arch segment it describes as a radian chunk. The angle between the adjacent black dots on the unit circle in Figure 1.1 is equal to a radian chunk. The phasor C(nT) and its components A(nT) and B(nT) can only be evaluated at each black dot corresponding to each radian chunk on the unit circle. Therefore the maximum number of samples that can represent a single cycle of a digital sine wave is equal to N.

If the digital oscillator that is generating the digital sinusoid is operating with a sample clock of fS Hz, then the phasor C(nT) would rotate around the unit circle in discrete radian chunks of 2π/N at the clock rate of fS Hz. The lowest radian frequency of the digital oscillator can be mathematically defined as

The lowest or fundamental frequency of the digital oscillator can be mathematically defined as

If we think about it for a minute, Equation 1.2 and Equation 1.3 make sense. If the phasor points to each black dot on the unit circle for one sample period, it will take N sample periods for it to move from dot zero to dot N – 1. In doing so, it will make one revolution of the unit circle stopping once at each black dot in N sample periods. It will take N sample periods to trace out exactly one sinusoidal cycle. The total period for each cycle will be equal to NT sec. The frequency of this sinusoidal cycle is then given by f = 1/(NT second) = (fS/N)Hz. Therefore the frequency of the sinusoids traced by the A(nT) and B(nT) components will be equal to (fS/N)Hz.

Let us look at a very simple example. Suppose we have a digital oscillator clocked with a sample clock of fS = 32 Hz, and suppose we decided that N will be 16. The unit circle is subdivided into 16 equal arc lengths, giving us 16 equal radian chunks. The rotating phasor C(nT) will be evaluated at 16 locations around the unit circle. This means there will be 16 samples per each period of the synthesized sinusoidal waveform. The digital radian frequency would be

or, since fK = ωK/2π, we can easily compute the digital oscillator frequency to be

In this simple example, 2 Hz is the lowest frequency other than zero that our simple digital oscillator can generate. This is based on the value of the sample frequency fS and our choice for the value of N. If, for the same sample rate, we had chosen N to be a larger number, then the resolution of fK would have been greater. For example, if we had selected N = 64, the lowest frequency other than 0 Hz that our oscillator could produce would be

This is a good start, but a digital oscillator that can produce only a single frequency isn’t as useful as an oscillator that can be programmed to produce any one of a whole range of discrete frequencies. Ideally, we would like to be able to program the digital oscillator to output any one of a wide range of discrete frequencies. We can achieve this enhancement with the addition of a multiplier “k” in Equation 1.2 and Equation 1.3. We can rewrite these equations to include the multiplier k such that

If k = 1, then the frequencies represented by Equation 1.4 are identical to those represented by Equation 1.2 and Equation 1.3. The value of k can take on discrete integer values ranging from 0 to N/2. In our previous example, we set fS = 32 Hz, and N = 16 so k could take on values of 0, 1, 2, 3, 4, 5, 6, 7, 8. All the possible frequency values that this example oscillator can take on are tabulated in Table 1.1.

#### Table 1.1. Example Digital Oscillator Frequencies

As we can see from the table, this oscillator can be programmed to produce one of nine possible frequencies with a resolution of 2 Hz. The addition of the variable k in Equation 1.4 causes the phasor C(nT) to rotate around the unit circle in multiples of 2π/N radian chunks at a rate of fS sample per second. When k is set to unity, the phasor will take on values at every black dot on the unit circle producing the oscillator’s lowest or fundamental frequency. In this case, each cycle of the generated sinusoid will be composed of N samples.

When k is set to 2, the phase angle of the phasor θ(nT) will increase in increments of two radian chunks each tick of the sample clock. The phasor C(nT) will take on the values of every second dot, and it will rotate around the unit circle twice as fast, producing a sine or cosine wave that is twice the fundamental frequency. In this case, each cycle of the sinusoid will be composed of half or N/2 samples. Similarly, when k is set to 4 the phasor will travel around the unit circle at four times the fundamental rate, taking on values at every fourth dot to produce an output frequency that is four times the fundamental frequency. Each cycle, however, will be composed of N/4 number of samples per cycle.

When k reaches its maximum value of N/2, which in this example is 8, there will be just two samples per sinusoidal period. The Nyquist rule states that two samples per cycle is the minimum number of samples allowed in order to be able to reconstruct an analog waveform from a digital waveform. This means that the highest frequency we can theoretically generate with a digital oscillator is half the sample rate or fS/2. In our example, when k = N/2 = 8, we were able to generate a sinusoid of 16 Hz, which is exactly half the 32 Hz sample rate.

In Table 1.1, a few of the entries for the “Samples per cycle” column are in fractions. All this means is that each cycle of the sinusoid is generated using a different subset of the N possible samples. That is, successive cycles of the sinusoidal waveform begin on a different sample value.

What happens if we continue to increase the value of k beyond N/2 (which in our example is 8)? If we were to let k = 9, there would be less than two samples per cycle, the Nyquist rule would be violated, and the output waveform would take on the same frequency as if the value of k had been set to 7. The resulting frequency is said to have been aliased or folded, about fS/2. Undersampling an analog sinusoid with an analog to digital converter will cause the digital output sinusoid it to alias down in frequency. This is identical to setting the multiplication factor k of a digital frequency to some number greater than N/2, which will result in the folding or aliasing about the Nyquist frequency of fS/2.

In our example, if we were to say k = 10, the resulting digital frequency would be identical to that obtained by saying k = 6. If we choose k = N – 1 or 15 in our example, the resulting frequency would be identical to the case where k = 1. We can see that all frequencies above k = 8 are folded or aliased down in frequency about the so-called folding frequency of fS/2 = 16Hz. In general, the frequency fN–K aliases down to fK{for (N/2) < k ≤ (N – 1)}.

A simple frequency folding diagram for the case where N = 16 is illustrated in Figure 1.2.

Care must be taken at the higher frequencies where the value of k approaches the upper limit of N/2. On paper there is no problem as kN/2, but in a hardware or software implementation the samples must be carefully selected. An extreme example would be setting k = N/2 and using the samples at 0 and π radians. This represents the optimum sample selection for a cosine wave, since the cosine sequence will take on the form

• B(T) = cos(nπ) = +1, –1, +1, –1, ··· {for n = 0,1,2,3,···}

but these same samples will produce a DC output of 0 for a sine waveform

• A(T) = sin (nπ) = 0,0,0,0,··· {for n = 0,1,2,3,···}

For this reason, in most designs dealing with narrow band signals, the minimum number of samples per cycle is usually held to some number around 2.5.

### InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

## Overview

Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

## Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

### Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

### Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

### Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

### Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

### Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

### Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

## Other Collection and Use of Information

### Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

### Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

### Do Not Track

This site currently does not respond to Do Not Track signals.

## Security

Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

## Children

This site is not directed to children under the age of 13.

## Marketing

Pearson may send or direct marketing communications to users, provided that

• Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
• Such marketing is consistent with applicable law and Pearson's legal obligations.
• Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
• Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

## Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

## Choice/Opt-out

Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

## Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

## Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

## Sharing and Disclosure

Pearson may disclose personal information, as follows:

• As required by law.
• With the consent of the individual (or their parent, if the individual is a minor)
• In response to a subpoena, court order or legal process, to the extent permitted or required by law
• To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
• In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
• To investigate or address actual or suspected fraud or other illegal activities
• To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
• To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
• To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.