# Use waveform math to extend the capabilities of your DSO or digitizer

#### Article By : Arthur Pini See how math operations can be used to extend the functionality of a digital oscilloscope or digitizer.

Even the simplest digital storage oscilloscope (DSO) or digitizer includes some form of waveform mathematics. Waveform math extends the usefulness of these data acquisition-based instruments. The simplest math operations are the basic set of arithmetic tools including summation, difference, product, and ratio. Most basic instruments also include the Fast Fourier Transform (FFT) to broaden the instruments view into the frequency domain.

More advanced instruments include complex math like integration and differentiation along with transcendental functions like logarithm, exponents, and exponential operations like squares and square roots. This article will use a range of math operations to provide some interesting examples of how useful they can really be.

Basic arithmetic

All these math tools greatly extend the operations of DSOs and digitizers beyond basic data acquisition and bring you into the domain of data interpretation and analysis. A classic example is using the difference operation to combine the component of a differential signal. Differential signals are formed by combining two components that are phased 180° apart, as shown in Figure 1. Figure 1 Use the difference math function to combine the components of a differential CAN-bus signal. The upper trace is CAN+, the middle trace is CAN-, and the bottom trace is the combined differential signal.

Two signal components of a CAN-bus signal, CAN+ (top trace) and CAN- (middle trace), are combined into the differential signal (bottom trace) by subtracting CAN- from CAN+. The resultant signal has twice the amplitude of either components. Signals are transmitted differentially to attenuate common mode node noise and interference. Common-mode signals are those that are common to both components. In the subtraction operation they are attenuated or eliminated. In the absence of a differential probe, differential signal components can be subtracted using the difference math function; this is called quasi-differential processing.

Another example is the use of the product of a voltage and a current waveform to calculate instantaneous power. The product waveform is formed by multiplying the values of two waveforms on a sample by sample basis. The waveforms involved must have common horizontal units and vertical scaling. An example of the application of the multiplication operation is taking the product of current and voltage to display and measure power. This is commonly done in switching power supply measurements as shown in Figure 2. Figure 2 Taking the product of the voltage across and the current through a power FET in a switched-mode power supply shows power loss in the device.

The upper trace in the figure is the Vds, the voltage across a power field-effect transistor (FET) from drain to source in a fly-back topology switched-mode power supply. The center trace represents the drain current through the FET, Id. When the FET is in conduction, the on state, the voltage is low, near 0V. During this time, the current through the device begins to increase linearly, controlled by the fly-back inductor.

When the FET stops conducting the voltage rises and the current returns to 0 amps. Power is dissipated in the FET only when there is simultaneous current and voltage, mainly during the transitions into and out of conduction. The lower trace is the product of the current and voltage waveforms and shows the instantaneous power on a sample by sample basis. The oscilloscope automatically sets the units to be watts.

The significant peaks in the instantaneous power waveform occur during the switching of the FET state both from non-conducting to conducting and vice versa. These peaks represent switching losses. There is a small power loss while the FET is on; this is a conduction loss equal to the product of the current waveform and the FET drain to source voltage, Vds, while it is in conduction. Typically, this voltage is small, amounting to only 1-2V. Likewise, there may be a small power loss while the FET is off and only a small leakage current may be flowing in the FET.

The total power dissipated by the FET is the average or mean of all these components. Measurement parameters under the waveform grid read the peak to peak drain-source voltage (260.7V) and the drain current (623 mA), along with the maximum instantaneous power (36.4 W) and the mean power (160 Mw).

The difference and product math functions have enabled an extended analysis of a set of basic measurements. All the math functions behave similarly and greatly extend the usefulness of the oscilloscope or digitizer.

Rescaling and integration

Next, we will use an example of a mechanical vibration measurement. An accelerometer is used to measure vibration of a small pump during operation. A piezoelectric accelerometer measures the acceleration of the pump body. The raw acquisition data can be scaled to read in units of acceleration by applying the rescale math function. Using repeated application of the integration math function, the velocity and displacement signals of the pump’s vibration signature can also be obtained, as shown in Figure 3. Figure 3 Acquiring, scaling, and integrating the signal from an accelerometer lets you obtain vibration measurements in units of acceleration, velocity, and displacement.

The top waveform is the raw electrical signal from the accelerometer. The sensitivity of this accelerometer is 100 mV per g. Rescale multiplies the waveform sample values by a user-entered constant and then adds another user-inserted constant, a linear scaling operation. It also allows the units to be switched and the affected traces appropriately labelled. The second waveform from the top has had rescaling applied and is now calibrated to read in acceleration units of meter per second per second (m/s2). Rescaling can also be applied from the input channel dialog box.

Integrating the acceleration signal yields the velocity of the pump’s vibration. The oscilloscope used for this measurement automatically updated the units to meters per second (m/s), as seen in the third trace from the top. The integration process includes a user-settable multiplicative and an additive constant to handle initial conditions in the integration process. In the bottom trace integration has been applied a second time, yielding the displacement vibration waveform. Units are now reported as meters.

Again, the use of math functions provides important views of the acquired data. Reading in the desired data format with appropriate units improves understanding and reduces the chance for erroneous readings.

Area enclosed by an X-Y plot

Many applications involving cyclic phenomena result in the need to determine the area enclosed by an X-Y plot. A typical example is, the area enclosed in a pressure-volume plot of an engine is proportional to the work done during the engine cycle. Similarly, power loss per cycle in a magnetic core is proportional to the area enclosed by a plot of magnetic field intensity against flux density, as displayed in a hysteresis plot (Figure 4). Figure 4 This image shows a typical magnetic hysteresis plot of magnetic field intensity plotted against flux density. The area enclosed inside the B-H curve is power loss per cycle.

The area enclosed in any X-Y plot can be calculated as:

Area = ∫ y(x) dx or Area= ∫ x(y) dy

Basically, integrating the area under the curve in the X-Y domain. However, the oscilloscope acquires waveforms as a function of time, so the process of finding the area inside the X-Y plot has to be reformulated in terms of time-based waveforms. The chain rule of differential calculus can be used to change the variables within the integral to calculate the area based on the acquired time traces:

Area = ∫ y(t) dx(t)⁄dt dt = ∫ x(t) dy(t)⁄dt dt

To implement this on a scope, we have to differentiate one of the traces then multiply it by the other trace and integrate the result. The integral, evaluated over 1 cycle of the periodic waveform, equals the area contained within the X-Y plot.

Generating an X-Y plot with a simple geometric shape will make it easy to verify the process. Let’s start with a circle, which is easy to generate using a sine and cosine wave, as seen in Figure 5. Figure 5 An X-Y diagram of a simple geometric shape is used as an example to verify the process.

The X-Y plot of 300-mV peak to peak sine and cosine waves has a frequency of 10 MHz. The diameter of the resulting circular X-Y plot is 300 mV and the area contained within this plot is 70.69 mV2.

The calculation of the area requires that one of the waveforms be multiplied by the derivative of the other and the product then be integrated over a single cycle of the waveform.

Taking a derivative can be a noisy process so it is recommended that the derivative should be calculated with the minimum number of points to minimize noise. In the following examples, the math operations were performed using 100 points. This is done using the sparse math function, which performs a user-controlled decimation of the waveform.

Figure 6 shows the progression of operations used to perform the calculation. Figure 6 This image shows the steps in computing the area contained in an X-Y plot. Channel 2 is multiplied by the derivative of channel 1 and the product is integrated. Cursors read the difference in the amplitude of the integral over a single cycle to obtain the area.

Based on the equation that was developed earlier, the derivative of channel 1 is multiplied by channel 2 and the result integrated. The channel 1 trace is the top trace in the figure. The oscilloscope used for this example supports dual math operations. The sparse operation and the derivative are calculated in math trace F1, the third trace down from the top. The product of channel 2 and the derivative of channel 1 are multiplied and integrated in math trace F2, another dual math function.

Horizontal difference cursors read the difference in amplitude of the integral over one complete 100 ns cycle of the waveform. The result is read in the dialog box of the integral function F2 as 70.47 mV2. This is within about 0.3% of the original estimate, which is well within the accuracy of the oscilloscope.

These four examples provide good illustrations of how math operations, of varying degrees of complexity, can be used to extend the functionality of an oscilloscope or a digitizer. Not every oscilloscope or digitizer offers the same math capabilities, but you should be aware of the possibilities.

Arthur Pini is a technical support specialist and electrical engineer with over 50 years experience in electronics test and measurement.

Related articles: 