Instant CIC
Summary:
A floating point model for a CIC decimator, including the frequency response.
Description:
A CIC filter relies on a peculiarity of its fixed-point implementation: Normal operation involves repeated internal overflows that have no effect to the output signal, as they cancel in the following stage.
One way to put it intuitively is that only the speed (and rate of change) of every little "wheel" in the clockworks carries information, but its absolute position is...
Accurate Measurement of a Sinusoid's Peak Amplitude Based on FFT Data
There are two code snippets associated with this blog post:
and
Testing the Flat-Top Windowing Function
This blog discusses an accurate method of estimating time-domain sinewave peak amplitudes based on fast Fourier transform (FFT) data. Such an operation sounds simple, but the scalloping loss characteristic of FFTs complicates the process. We eliminate that complication by...
Impulse Response Approximation
Recently, I stumbled upon a stepped-triangular (ST) approximation that can be implemented as a cascade of recursive running sum (RRS) filters. The following is a short introduction to the stepped-triangular approximation.The stepped-triangular approximation was introduced by Jovanovic-Dolecek and Mitra [1] as a quantized approximation of a low-pass filter (LPF). Figure 1 shows an example of the approximation.
[Figure 1: Stepped Approximation of a LPF...
Multiplying Two Binary Numbers
I just encountered what I think is an interesting technique for multiplying two integer numbers. Perhaps some of the readers here will also find it interesting.
Here's the technique: assume we want to multiply 18 times 17. We start by writing 18 and 17, side-by-side in column A and column B, as shown at the top of Figure 1. Next we divide the 18 at the top of column A by two, retaining only the integer part of the division, and double the 17 at the top of column B. The results of those two...
Implementing a full-duplex UART using the TMS320VC33 serial port
Although the TMS320VC33 serial port was designed to be used as a synchronous port, it can also be used as an asynchronous port under software control. This post describes the hardware and software needed to use a TMS320VC33 serial port as a full-duplex UART port. A schematic diagram and a lengthy code listing are provided to illustrate the solution. This note discusses the implementation of an interrupt-driven, full-duplex, asynchronous serial interface, 9600-baud UART with 8 data bits, 1...
"Neat" Rectangular to Polar Conversion Algorithm
The subject of finding algorithms that estimate the magnitude of a complex number, without having to perform one of those pesky square root operations, has been discussed many times in the past on the comp.dsp newsgroup. That is, given the complex number R + jI in rectangular notation, we want to estimate the magnitude of that number represented by M as:
On August 25th, 2009, Jerry (Mr. Wizard) Avins posted an interesting message on this subject to the comp.dsp newsgroup (Subject: "Re:
Improved Narrowband Lowpass IIR Filters
Here's a neat IIR filter trick. It's excerpted from the "DSP Tricks" chapter of the new 3rd edition of my book "Understanding Digital Signal Processing". Perhaps this trick will be of some value to the subscribers of dsprelated.com.
Due to their resistance to quantized-coefficient errors, traditional 2nd-order infinite impulse response (IIR) filters are the fundamental building blocks in computationally-efficient high-order IIR digital filter implementations. However, when used in...
Least-squares magic bullets? The Moore-Penrose Pseudoinverse
Hello,
the topic of this brief article is a tool that can be applied to a variety of problems: The Moore-Penrose Pseudoinverse.While maybe not exactly a magic bullet, it gives us least-squares optimal solutions, and that is under many circumstances the best we can reasonably expect.
I'll demonstrate its use on a short example. More details can be found for example on Wikipedia, or the Matlab documentation...
Computing FFT Twiddle Factors
Some days ago I read a post on the comp.dsp newsgroup and, if I understood the poster's words, it seemed that the poster would benefit from knowing how to compute the twiddle factors of a radix-2 fast Fourier transform (FFT).
Then, later it occurred to me that it might be useful for this blog's readers to be aware of algorithms for computing FFT twiddle factors. So,... what follows are two algorithms showing how to compute the individual twiddle factors of an N-point decimation-in-frequency...
Hidden Linear Algebra in DSP
Linear algebra (LA) is usually thought of as a blunt theoretical subject. However, LA is found hidden in many DSP algorithms used widely in practice.
An obvious clue in finding LA in DSP is the linearity assumption used in theoretical analysis of systems for modelling or design. A standard modelling example for this case would be linear time invariant (LTI) systems. LTI are usually used to model flat wireless communication channels. LTI systems are also used in the design of digital filter...
Accurate Measurement of a Sinusoid's Peak Amplitude Based on FFT Data
There are two code snippets associated with this blog post:
and
Testing the Flat-Top Windowing Function
This blog discusses an accurate method of estimating time-domain sinewave peak amplitudes based on fast Fourier transform (FFT) data. Such an operation sounds simple, but the scalloping loss characteristic of FFTs complicates the process. We eliminate that complication by...
Is It True That j is Equal to the Square Root of -1 ?
A few days ago, on the YouTube.com web site, I watched an interesting video concerning complex numbers and the j operator. The video's author claimed that the statement "j is equal to the square root of negative one" is incorrect. What he said was:
He justified his claim by going through the following exercise, starting with:
Based on the algebraic identity:
the author rewrites Eq. (1) as:
If we assume
Eq. (3) can be rewritten...
Least-squares magic bullets? The Moore-Penrose Pseudoinverse
Hello,
the topic of this brief article is a tool that can be applied to a variety of problems: The Moore-Penrose Pseudoinverse.While maybe not exactly a magic bullet, it gives us least-squares optimal solutions, and that is under many circumstances the best we can reasonably expect.
I'll demonstrate its use on a short example. More details can be found for example on Wikipedia, or the Matlab documentation...
Computing an FFT of Complex-Valued Data Using a Real-Only FFT Algorithm
Someone recently asked me if I knew of a way to compute a fast Fourier transform (FFT) of complex-valued input samples using an FFT algorithm that accepts only real-valued input data. Knowing of no way to do this, I rifled through my library of hardcopy FFT articles looking for help. I found nothing useful that could be applied to this problem.
After some thinking, I believe I have a solution to this problem. Here is my idea:
Let's say our original input data is the complex-valued sequence...
Using Mason's Rule to Analyze DSP Networks
There have been times when I wanted to determine the z-domain transfer function of some discrete network, but my algebra skills failed me. Some time ago I learned Mason's Rule, which helped me solve my problems. If you're willing to learn the steps in using Mason's Rule, it has the power of George Foreman's right hand in solving network analysis problems.
This blog discusses a valuable analysis method (well known to our analog control system engineering brethren) to obtain the z-domain...
Harmonic Notch Filter
My basement is covered with power lines and florescent lights which makes collecting ECG and EEG data rather difficult due to the 60 cycle hum. I found the following notch filter to work very well at eliminating the background signal without effecting the highly amplified signals I was looking for.
The notch filter is based on the a transfer function with the form $$H(z)=\frac{1}{2}(1+A(z))$$ where A(z) is an all pass filter. The original paper [1] describes a method to...
Exact Near Instantaneous Frequency Formulas Best at Peaks (Part 1)
IntroductionThis is an article that is a another digression from trying to give a better understanding of the Discrete Fourier Transform (DFT). Although it is not as far off as the last blog article.
A new family of formulas for calculating the frequency of a single pure tone in a short interval in the time domain is presented. They are a generalization of Equation (1) from Rick Lyons' recent blog article titled "Sinusoidal Frequency Estimation Based on Time-Domain Samples"[1]. ...
Exploring Human Hearing Range
Human Hearing RangeIn this post, I'll look at an interesting aspect of Audacity – using it to explore the threshold of human hearing. In my book Digital Signal Processing: A Gentle Introduction with Audio Examples, I go into this topic and I include a side note on the amazing hearing range of our canine companions.
Creating a Test Audio FileAudacity allows for the generation of a variety of test signals. If you click the Generate->Tone menu, it looks something like...
Fibonacci trick
I'm working on a video, tying the Fibonacci sequence into the general subject of difference equations.
Here's a fun trick: take any two consecutive numbers in the Fibonacci sequence, say 34 and 55. Now negate one and use them as the seed for the Fibonacci sequence, larger magnitude first, i.e.
$-55, 34, \cdots$
Carry it out, and you'll eventually get the Fibonacci sequence, or it's negative:
$-55, 34, -21, 13, -8, 5, -3, 2, -1, 1, 0, 1, 1 \cdots$
This is NOT a general property of difference...
TCP/IP interface (Matlab/Octave)
Communicate with measurement instruments via Ethernet (no-toolbox-Matlab or Octave)
PurposeMeasurement automation is digital signal processing in a wider sense: Getting a digital signal from an analog world usually involves some measurement instruments, for example a spectrum analyzer. Modern instruments, and also many off-the-shelf prototyping boards such as FPGA cards [1] or microcontrollers [2] are able to communicate via Ethernet. Here, I provide some basic mex-functions (compiled C...
A Fast Real-Time Trapezoidal Rule Integrator
This blog presents a computationally-efficient network for computing real‑time discrete integration using the Trapezoidal Rule.
Background
While studying what is called "N-sample Romberg integration" I noticed that such an integration process requires the computation of many individual smaller‑sized integrations using the Trapezoidal Rule integration method [1]. My goal was to create a computationally‑fast real‑time Trapezoidal Rule integration network to increase the processing...
Computing an FFT of Complex-Valued Data Using a Real-Only FFT Algorithm
Someone recently asked me if I knew of a way to compute a fast Fourier transform (FFT) of complex-valued input samples using an FFT algorithm that accepts only real-valued input data. Knowing of no way to do this, I rifled through my library of hardcopy FFT articles looking for help. I found nothing useful that could be applied to this problem.
After some thinking, I believe I have a solution to this problem. Here is my idea:
Let's say our original input data is the complex-valued sequence...
Computing Translated Frequencies in Digitizing and Downsampling Analog Bandpass Signals
In digital signal processing (DSP) we're all familiar with the processes of bandpass sampling an analog bandpass signal and downsampling a digital bandpass signal. The overall spectral behavior of those operations are well-documented. However, mathematical expressions for computing the translated frequency of individual spectral components, after bandpass sampling or downsampling, are not available in the standard DSP textbooks. The following three sections explain how to compute the...
Resolving 'Can't initialize target CPU' on TI C6000 DSPs - Part 2
Configuration
The previous article discussed CCS configuration. The prerequisite for the following discussion is a valid CCS configuration file. All references will be for CCS 3.3, but they may be used or adapted to other versions of CCS. From the previous discussion, we know that the configuration file is located at 'C:\CCStudio_v3.3\cc\bin\brddat\ccBrd0.dat'.
XDS510 Emulators
Initial discussion will address only XDS510 class emulators that support TI drivers and utilities. This will...
Harmonic Notch Filter
My basement is covered with power lines and florescent lights which makes collecting ECG and EEG data rather difficult due to the 60 cycle hum. I found the following notch filter to work very well at eliminating the background signal without effecting the highly amplified signals I was looking for.
The notch filter is based on the a transfer function with the form $$H(z)=\frac{1}{2}(1+A(z))$$ where A(z) is an all pass filter. The original paper [1] describes a method to...
Specifying the Maximum Amplifier Noise When Driving an ADC
I recently learned an interesting rule of thumb regarding the use of an amplifier to drive the input of an analog to digital converter (ADC). The rule of thumb describes how to specify the maximum allowable noise power of the amplifier [1].
The Problem Here's the situation for an ADC whose maximum analog input voltage range is –VRef to +VRef. If we drive an ADC's analog input with an sine wave whose peak amplitude is VP = VRef, the ADC's output signal to noise ratio is maximized. We'll...
A Remarkable Bit of DFT Trivia
I recently noticed a rather peculiar example of discrete Fourier transform (DFT) trivia; an unexpected coincidence regarding the scalloping loss of the DFT. Here's the story.
DFT SCALLOPING LOSS As you know, if we perform an N-point DFT on N real-valued time-domain samples of a discrete sine wave, whose frequency is an integer multiple of fs/N (fs is the sample rate in Hz), the peak magnitude of the sine wave's positive-frequency spectral component will be
where A is the peak amplitude...
Hidden Linear Algebra in DSP
Linear algebra (LA) is usually thought of as a blunt theoretical subject. However, LA is found hidden in many DSP algorithms used widely in practice.
An obvious clue in finding LA in DSP is the linearity assumption used in theoretical analysis of systems for modelling or design. A standard modelling example for this case would be linear time invariant (LTI) systems. LTI are usually used to model flat wireless communication channels. LTI systems are also used in the design of digital filter...
"Neat" Rectangular to Polar Conversion Algorithm
The subject of finding algorithms that estimate the magnitude of a complex number, without having to perform one of those pesky square root operations, has been discussed many times in the past on the comp.dsp newsgroup. That is, given the complex number R + jI in rectangular notation, we want to estimate the magnitude of that number represented by M as:
On August 25th, 2009, Jerry (Mr. Wizard) Avins posted an interesting message on this subject to the comp.dsp newsgroup (Subject: "Re:
A brief look at multipath radio channels
Summary: Discussion of multipath propagation and fading in radio links
Radio channels, their effects on communications links and how to model them are a popular topic on comp.dsp. Unfortunately, for many of us there is little or no opportunity to get any "hands-on" experience with radio-related issues, because the required RF measurement equipment is not that easily available.This article gives a very simple example of a radio link that shows multipath propagation and...