5
1094-6969/07/$25.00©2007IEEE February 2007 IEEE Instrumentation & Measurement Magazine 29 N ow that we are adults, we may not remember exactly how we learned to count but it probably involved associating numbers with real objects. If we have children and are teaching them to count, we ask them questions like “How many people are there in this picture?” During school days, children learn about decimals, fractions, and eventually complex numbers before going to college. When the concept of complex numbers was first intro- duced, it served the purpose of accommodating the square root of negative numbers. Rarely has any- one realized the full usefulness of complex numbers; it goes far beyond the initial application. In instrumentation and measurement, when we measure a voltage, a current, a power, or when we measure acceleration, force, pressure, or temperature, traditionally we dealt only with real num- bers. We used complex numbers only once in a while; for instance, to calculate the impedance of an RC circuit. Despite the fact that complex numbers were obtained in more sophisticated measure- ments when Fourier’s analysis was performed, phase information was usually considered as a side product and ignored in most applications. © EYEWIRE February 2007 IEEE Instrumentation & Measurement Magazine 29 Replacing real values with complex can lead to new ideas Fang Xu

Imaginary part – A source of creativity

Embed Size (px)

Citation preview

Page 1: Imaginary part – A source of creativity

1094-6969/07/$25.00©2007IEEEFebruary 2007 IEEE Instrumentation & Measurement Magazine 29

Now that we are adults, we may not remember exactly how we learned to count but itprobably involved associating numbers with real objects. If we have children and areteaching them to count, we ask them questions like “How many people are there in thispicture?” During school days, children learn about decimals, fractions, and eventually

complex numbers before going to college. When the concept of complex numbers was first intro-duced, it served the purpose of accommodating the square root of negative numbers. Rarely has any-one realized the full usefulness of complex numbers; it goes far beyond the initial application.

In instrumentation and measurement, when we measure a voltage, a current, a power, or whenwe measure acceleration, force, pressure, or temperature, traditionally we dealt only with real num-bers. We used complex numbers only once in a while; for instance, to calculate the impedance of anRC circuit. Despite the fact that complex numbers were obtained in more sophisticated measure-ments when Fourier’s analysis was performed, phase information was usually considered as a sideproduct and ignored in most applications.

© EYEWIRE

February 2007 IEEE Instrumentation & Measurement Magazine 29

Replacing real values with complex

can lead to new ideas

Fang Xu

Page 2: Imaginary part – A source of creativity

How to Calculate the Data

Step 1: Perform a Forward DFT

If the data is real valued, then its transform hascomplex-valued Hermitian symmetry in the spec-tral domain, so we only need to save the positivepart of the transformed data. For complex-valueddata, this step is optional if the integer portion ofthe number of cycles in the capture M is known(7.75 in this example).

Step 2: Locate the Fundamental Bin M 0

The DFT will round this number to the closest inte-ger (8 in this example).

Step 3: Perform Inverse DFT

For real-valued original data, perform an inverseFourier transform on the positive half of the previ-ous transform to obtain an N/2 complex-valueddata set in the same domain as the original data.This new set of data contains all the information ofthe original data set. For complex-valued data, skipthis step and use the original data instead. Save thisdata set for later use.

Step 4: Demodulate by Waveform of M 0 Periods

Multiply each complex-valued sample by complexfunction

e−j2πM0N i

Only the fractional period remains in the waveformafter this operation (–0 .25 in this example). Onlythe phase of each sample has been changed; theamplitude is unchanged.

Step 5: Compute the Phase

The simplest version just needs the phase at thebeginning and the end of the waveform while thephase of each sample will be needed if a linearregression method will be used. The phase of acomplex number can be calculated by arctangentfunction. Most of the math library resources use the“atan2” function.

DF

T

0

Time Domain

Frequency Domain

DF

T−1

Time Domaintan

−1

RI

ϕ

30 IEEE Instrumentation & Measurement Magazine February 2007

Page 3: Imaginary part – A source of creativity

February 2007 IEEE Instrumentation & Measurement Magazine 31

In very rare applications, such as magnetic resonance, wewould measure a physical phenomenon, which is represent-ed by complex numbers. Since magnet resonance systemsare so complex, there is even a separate Society within theIEEE to deal with those issues. Complex numbers have beenmore widely used in telecommunication, in which ampli-tude and phase of the sine wave are modulated. Moderninformation coding schemes apply complex numbers toitems we use in our daily life, such as a cell-phone, a wirelessLAN, etc. However, we do not realize the fullest potential ofcomplex numbers until we extend the application of com-plex numbers to window functions in which only real num-bers have been traditionally used.

Historians may tell us in which epoch the first buildingwindow was built by our ancestors. Rectangular windowsare undoubtedly more ancient than curved windows. Thesky and the landscape that we see through a window take theshape of the window. We can take this word picture andapply it to a measurement problem. To analyze a signal digi-

tally in instrumentation and measurement, we need to recorda series of samples of that signal, which we refer to as a cap-tured waveform. A captured waveform is just the portion ofa signal that we can observe through a rectangular window.As a matter of fact, a rectangular window function is alwaysapplied whether intentionally or unintentionally.

How to Calculate Waveform DataThe discrete Fourier transform (DFT) is a widely used pow-erful signal analysis method. The discrete nature of themethod implies that the captured waveform being analyzedis a portion of a periodic signal, and the transform is per-formed on a whole period or an integer multiple of periods.We call this procedure coherent sampling in which, no mat-ter when the capture starts, the end point of the capturedwaveform could be connected to the first sample in the cap-tured waveform in the same fashion as the next noncapturedsample (Figure 1). Thus, the rectangular window will inter-fere with neither the captured waveform nor the DFT.

Step 6: Calculate the Phase Difference �P and slope �P = 2π M1

The phase difference is the fractional portion of thesine wave’s number of cycles, which is 2π for acomplete cycle of original data (–0 .25 in this exam-ple); the slope is the remaining frequency of thatfraction. (Remember the signal can be only the halfsize if the real-to-complex Fourier transform isused.)

Step 7: Application of Complex Window Function

This step is a signal twiddle operation by fractionportion of M cycles (0.25 in this example). Simplymultiply each complex-valued i th sample saved atStep 3 by

e−j2π �PN i

At this point, there will be exactly an integer num-ber of periods in the data set. (8 in this example).

Final Step: Perform a Complex-Valued FourierTransform

The fundamental will be free of leakage in the fre-quency domain.

∆P

Time Domain

RI

DF

T

0

Time Domain

Frequency Domain

ϕ

Page 4: Imaginary part – A source of creativity

32 IEEE Instrumentation & Measurement Magazine February 2007

On the other hand, if we cap-ture a nonperiodic signal or if wecapture a periodic signal withoutcapturing an integer number ofperiods, the captured waveformwould be incoherently sampled,and, consequently, the end point ofthe captured waveform could notbe connected to the first sample inthe captured waveform in thesame way as the next noncapturedsample (Figure 2). This would sub-sequently lead to truncation by therectangular window, which vio-lated the condition under whichthe DFT can be applied. In this situation, a special windowfunction needs be applied to the captured waveform beforeapplying the DFT.

In window functions, theshapes of the windows aredesigned in such a way that theheight reaches maximum at thecenter and gradually reduces tozero towards the edges (Figure 3).When this shape is multiplied by acaptured signal, no matter whatthe original signal looks like, itsamplitude will progressivelyreduce to zero from the center tothe side As a result, the sample atthe end could be connected to thesample at the beginning in themodified waveform in the same

way as to the next noncaptured sample if it is considered asa repetition of the first sample in an artificial periodic signal.Time-domain multiplication is equivalent to a convolution inthe frequency domain—the convolution created by theFourier transform into a window function. The side effect ofthis operation is the introduction of an artificial structure tothe original signal being transformed and a reduction ofspectrum resolution. To minimize this effect, the windowfunction is also designed in such a way that its first deriva-tive tends to be zero in the center and at both ends.Commonly used window functions include the Hammingwindow, Hanning window, and Blackman window. Now,we have witnessed the evolution of window functions fromrectangular shapes to curved shapes.

Like building windows, both the rectangular and curvedwindows still share a common planar structure. If our imagi-nation can stretch beyond this two-dimensional structure,we can obtain solutions that will not be limited by the shapeof windows. As an example, add a third dimension. In thecase of window functions, the initial real-valued functions

We do not realize the

fullest potential of

complex numbers until

we extend their

application to window

functions in which only

real numbers have been

traditionally used.

Fig. 2. If we capture a nonperiodic signal or if we capture a periodic signalwithout capturing an integer number of periods, then the end point of thisincoherently captured waveform (black dot) could not be connected to the firstsample in the captured waveform (red square) in the same way as the nextnoncaptured sample (blue triangle).

Rectangular Window

Fig. 1. Use of the discrete Fourier transform implies that the capturedwaveform being analyzed is a portion of a periodic signal and the transform isperformed on a whole period or an integer multiple of periods. The end pointof the captured waveform (black dot) could be connected to the first sample inthe captured waveform (red square) in the same fashion as the nextnoncaptured sample (blue triangle).

Rectangular Window

Fig. 3. When using window functions, the shape of the windows aredesigned in such a way that the height reaches maximum at the center andreduces progressively to zero towards the edges. When this shape ismultiplied by a captured signal, no matter what the original signal looks like,its amplitude will progressively reduce to zero from the center to the side. Asa result, the sample at the end (black dot) could be connected to the sample atthe beginning (red square) in the modified waveform in the same way as tothe next noncaptured sample (blue triangle) if it is considered as a repetitionof the first sample in an artificial periodic signal.

Window Applied

Page 5: Imaginary part – A source of creativity

February 2007 IEEE Instrumentation & Measurement Magazine 33

versus time will become complex-valued functions versus time. Real-valued window functions arelimited to performing amplitudemodulation, whereas complex-val-ued window functions have theadvantage of being able to performboth amplitude and phase modula-tions. Following this logic, weshould be able to find complex-val-ued window functions and apply them to noncoherentlycaptured waveforms without the side effects that are associ-ated with real-valued window functions.

Such a window function has been found and has beensuccessfully applied to captured sine waves that include afractional period of a sine wave and it produces no artifacts.If the usual direct application of the DFT is applied, it willresult in artifacts, or spectrum leakage. The first applicationof this complex-valued window function is to test it in high-performance analog-to-digital converters in which frequencyerror due to limited frequency resolution, or drift of instru-ment, could cause significant spectrum leakage. The solutionto that problem usually includes either investment of a costlyhigh-performance frequency synthesizer or using a highspectral purity oscillator, the frequency of which could notbe easily controlled.

The Complex-Valued Window Function:Extended Fourier TransformAs mentioned earlier, the DFT could be directly applied to acoherently captured waveform in which the end point of thesignal could be connected to the next noncaptured sample inthe same way as the first sample in the captured waveform.When the captured waveform has a factional period of sinewave, the previous condition will not be satisfied; that is,either the sine wave frequency is too low or too high com-pared to the time interval required to capture the signal Ifwe can change the angular velocity of the captured sinewave, we can make a sine wave with an integer number ofperiods. This operation is very simple if we decompose asinusoidal function of a sine wave into a complex expression(Step 3 in How to Calculate the Data). Then, we can roundthe number of periods of that complex waveform to the nextinteger number by considering a multiplication of a twiddlefunction, which we refer to as the complex-valued windowfunction (Step 7 in How to Calculate the Data). The twiddlefunction could be determined according to the actual fre-quency of the captured waveform by allowing the utilizationof free running crystal oscillators as in the application of test-ing high-performance analog-to-digital converters. Then,apply the complex-valued Fourier transform (Final Step inHow to Calculate the Data). We call this method the extend-ed Fourier transform (FXT) for a noncoherently capturedwaveform. The details of the original algorithm have beenpresented in [2].

ConclusionsAlthough this algorithm hasopened a new horizon to solve anold problem, more research is need-ed to provide a more comprehen-sive understanding as to how FXTforms a new orthonormal base andhow it relates to 3-parameter or 4-parameter sine wave fitting methods[3], [4]. In the case of a multitone

application or when a sine wave application has a high level ofharmonic components, will the algorithm published in the orig-inal paper be sufficient or is a better method available?

In essence, there is a need to identify other areas wherereal values can be replaced by complex values because itmay lead to new solutions and ideas. Once these areas havebeen identified, we will be confronted with another chal-lenge: how should we teach our children to think beyond thetwo-dimensional structure to include the complex numberdimension when they are learning to count? Would we ask,“How many people are there in the picture?” If the responseis “Two!” then would we ask, “Can you see if there are anyother people behind them?”

References

[1] F.J. Harris, “On the use of windows for harmonic analysis with the

discrete Fourier transform,” Proc. IEEE, vol. 66, pp. 51–83, Jan. 1978.

[2] F. Xu “Algorithm to remove spectral leakage, close-in noise, and

its application to converter test,” in Proc. IEEE Instrumentation

Measurement Technology Conf., Sorrento, Italy, Apr. 2006, pp.

1038-1042.

[3] I. Kollar and J. Blair, “Improved determination of the best fitting

sine wave in ADC testing,” IEEE Trans. Instrum. Meas. vol. 54,

no. 5, pp. 1978–1983, 2005.

[4] T.Z. Bilau, T. Megyeri, A. Sarhegyi, J. Markus, and I. Kollar, “Four

parameter fitting of sine wave testing result: Iteration and

convergence,” Comput. Standards Interfaces, vol. 26, pp. 51–56, 2004.

Fang Xu ([email protected]) received the License enScience in electronique electrotechnique et automatique andDiplôme d’étude approfondie in instrumentation from theUniversité Paris Sud, France, in 1983 and 1985, respectively, andthe Docteur en Science from the same university in 1990. Heworked at Drusch SA from 1985 to 1994 and designed nuclearmagnetic resonance spectrometer and imaging systems. He iscurrently the senior technologist at Teradyne’s semiconductortest division. He has been an invited speaker at multiple interna-tional semiconductor test conferences. He holds multiplepatents in instrumentation techniques and architectures. He is acommittee member of IEEE TC-10, working on standards 1057,1241, and p1658. His recent publication of “Algorithm toremove spectral leakage, close-in noise, and its application toconverter test” received the best paper award at the 2006 IEEEInstrumentation Measurement Technology Conference.

We have witnessed

the evolution of window

functions from

rectangular shapes to

curved shapes.