What you do with math channels on oscilloscope? - Page 1
Forum section: electronics / testgear

author: MrWolf
author_rank: Regular Contributor
timestamp: January 04, 2017, 04:34:54 pm
content: Many modern scopes have math features and people seem to like when it's in the datasheet. But how you use them besides most obvious AxB and integral(AxB) fo power calculations? Could you post these please? I'm learning RF currently and math channels get more and more used, mostly have to "invent" the stuff because "out of the box" info on the net is pretty scarce on the subject...Recently played a bit with differential function and finallyunderstoodwhat it's useful forWhy the hell they dont teach it interactively in the school

author: daqq
author_rank: Super Contributor
timestamp: January 04, 2017, 05:31:44 pm
content: Well, there's the FFT, I've also used the subtraction, when I needed to know the voltage on the part when I could not ground the probes against one end of the part and connect it to the other end - basically I used it as a poor mans' differential probe. I did this for both a power signal and a differential high-ish speed signal.Then there's the divide function, when you need to check for instance the ratio of an amplified signal... There's a lot of functions that can be checked like this.

author: Amazing
author_rank: Regular Contributor
timestamp: January 04, 2017, 05:42:52 pm
content: You can use A-B to view a differential signal if you lack a differential probe.You can use differentiation followed by FFT to show the scope's frequency response curve. I took a crack at that here:https://www.eevblog.com/forum/testgear/what-is-a-good-and-cheap-way-to-do-frequency-response-testing-on-a-scope/You can use averaging on a waveform to get a cleaner picture of it, or use averaging on an FFT to try to pull signals out of the noise.

author: MrWolf
author_rank: Regular Contributor
timestamp: January 04, 2017, 08:52:35 pm
content: Here's neat trick that I use lately... It's quite painful to watch all those unused (and paid for!) MSO digital wires dangling around. I do not ever remember using more than 8 at the time for debugging. But I often miss at least one more analog channel. So it struck me I can do software DAC. Up to 16bit! Also it happends that my scope is only 25MHz analog but 100MHz & 200MSa/s digital!So here it is - PicoScope 2205 MSO doing software analog to digital to analog using math channel12bit ADACusing Arduino Due as 7MSa/s pattern generator producing 12x12bit sine wave.Math formula:LowPass((2048*D11+1024*D10+512*D9+256*D8+128*D7+64*D6+32*D5 +16*D4+8*D3+4*D2+2*D1+ 1*D0)/4096, 100000)-0.58bit ADACusing Arduino Uno R3 asvoltmeterlistening to PSU voltage with analog pin & resistive voltage divider:Math formula:LowPass((128*D7+64*D6+32*D5 +16*D4+8*D3+4*D2+2*D1+ 1*D0)/256, 100000)*14.7Last number is tweaked according to voltage divider (Do not exceed Arduino 5V input!)Here is test setupconnected to Arduino Uno and Agilent UT1272A as control:Most cool thing that there is no noise which is often present on just analog channel. And I can rig it up to form even 2 additional 8bit analog channels. Sadly I have no pattern generator or ADC fast enough to see if it will really push to 100MHz & 16bit analog.Currently I use 100kHz LowPass to remove random peak glitches. When pushing for speed records this should be removed or reset to higher frequency.If there is time skew due to Arduino processing time you can create time-skewed copies of real analog channels using formulaX, for exampleA[-0.000001]should delay analog by 1 microsecond. Least possible step is 1ns AFAIK.Arduino sketches attached for both scenarios.New faster 59kSa/s sketch for Arduino UnoJust wondering - do you know is this done before? DAC formula is no headline news but using with MSO?

author: HighVoltage
author_rank: Super Contributor
timestamp: January 04, 2017, 08:57:34 pm
content: Here is a simple example that I am using all the time.Channel 1: VoltageChannel 2: CurrentMath 1: Channel 1 * Channel 2 = POWER (Watt)Math 2: INTEGRATING POWER = ENERGY (Joules)

author: rstofer
author_rank: Super Contributor
timestamp: January 04, 2017, 09:27:33 pm
content: Quote from: HighVoltage on January 04, 2017, 08:57:34 pmI have never tried measuring power or energy. I am curious about the integral. Is it increasing only? As in Watt-Hours accumulated? Or is it a true integral that rolls back when P(t) < P(t-1)?

author: Amazing
author_rank: Regular Contributor
timestamp: January 04, 2017, 10:09:55 pm
content: Quote from: rstofer on January 04, 2017, 09:27:33 pmI also have never used the integral function and was curious about it as well, so I tried it on my scope.When P(t) < P(t-1) the integral keeps increasing, which is what I would expect because the area under the curve is still accumulating.When P(t) goes negative, then the integral begins to decrease.So the integral of sin wave is another sin wave, shifted 90 degrees. Or put another way, the integral of sin(t) dt = -cos(t), just like in calculus class.

author: Amazing
author_rank: Regular Contributor
timestamp: January 04, 2017, 10:13:01 pm
content: MrWolf,that is a very neat trick for getting the most out of your scope. I had no idea that the pico scopes supported such complex math. I guess it makes sense since they have all the processing of a PC available to them.Some standalone scopes let you do this too, by defining a parallel bus on the digital channels, and then plotting the value of the bus.

author: nctnico
author_rank: Super Contributor
timestamp: January 04, 2017, 10:21:18 pm
content: Quote from: rstofer on January 04, 2017, 09:27:33 pmMeasuring power can be handy to see if a transistor or MOSFETs stays within safe limits during switching or a pulsed event. The V*I math trace will show where and how long peak power occurs. The duration, current and voltage of the peak power event can then be checked with the SOA graph.

author: MrWolf
author_rank: Regular Contributor
timestamp: January 04, 2017, 10:27:25 pm
content: Quote from: Amazing on January 04, 2017, 10:13:01 pmThanksThis is just scratching the surface... It's actually quite addictive to mess around with it. I'm working on something a bit more complex but this is too raw to publish yet.One more useful example (found from PicoTech forum):acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/pi*180This is phase between channels A and B using integration. Have not yet used it on unequal shape and form waves. So apply at your own risk.

author: NorthGuy
author_rank: Super Contributor
timestamp: January 04, 2017, 10:54:11 pm
content: Quote from: MrWolf on January 04, 2017, 10:27:25 pmIt's correlation formula. Will only show phase if the shape is exactly the same (except phase shift). For in-phase signals, it'll measure the similarity between waveforms (if you remove "acos" and scaling). It'll be "1" if the signals are completely the same (ignoring scale) and "0" if they're completely dissimilar. "-1" will mean the same sinal, but inverted. You can use the formula to measure how similar is your waveform to the sine wave (or any other signal you may want to use as an etalon).

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: January 05, 2017, 12:21:54 am
content: Integral can be useful for estimating total battery draw from a device that draws a complex current waveform due to frequently changing modes etc.

author: JPortici
author_rank: Super Contributor
timestamp: January 05, 2017, 05:20:19 am
content: what i wish i could do in every scope was math with measurements. sometimes i'm too lazy to get out the pocket calculator and i can't always come up with a math channel then measurement on it(for example, things like freq A - freq B)some i've used can, some i've used can't. don't know about mid-high tier

author: vealmike
author_rank: Regular Contributor
timestamp: January 05, 2017, 10:45:16 am
content: 'scope math is really powerful if you know what you're doing. A complicated example of what can be achieved...Take eye diagram, 'scope will emulate a PLL and extract a golden clock.)Then, from the eye diagram, plot Time interval error (time difference between each received transition and the golden clock.)Then take an FFT of the TIE, to show the frequency content of the jitter.Then take an average of the FFT (recapture, recalculate, average) to eliminate random jitter and pull out the deterministic jitter.Then from the average FFT (plot of Dj frequency content) go find the peaks, correlate with noise sources on your PCB and apply remedies as necessary.

author: MrWolf
author_rank: Regular Contributor
timestamp: January 05, 2017, 10:58:35 am
content: Here's another one. So far used it just for learning but suspect might be useful tool:Generating harmonics on-the-fly on math channel using time as X input, then combining with some actual wave, replaying on AWG if needed.Example:10kHz sine on CH AHarmonics generation:sin(T*PI*40000)*0.501 + sin(T*PI*60000)*0.355 + sin(T*PI*80000)*0.251Combined with A:A + (sin(T*PI*40000)*0.501 + sin(T*PI*60000)*0.355 + sin(T*PI*80000)*0.251)Constants scale horizontal and vertical to match with signal to be combined with.

author: MrWolf
author_rank: Regular Contributor
timestamp: January 05, 2017, 08:17:19 pm
content: Got Arduino Uno ADAC sketch little faster, was 9kSa/s => 59kSa/s. Almost good setting for filter is 25kHz*. Full horizontal resolution <=230Hz. Good sine max 5900Hz. Processing delay 21us. Tested direct input w/o voltage divider for frequency response. Note this is all limited by Arduino Uno, not scope.*Filter could be better I guess, maybe even multi-stage.

author: Iceberg86300
author_rank: Contributor
timestamp: January 05, 2017, 10:33:29 pm
content: There is also a use in the mechanical world. Non contact transducers perpendicular to each other and placed at a rotating shaft.One channel per transducer, and plot them against each other. This will show deflection of the shaft as it rotates. You end up with an ellipse/circle, and then using math functions you can determine where the where the heavy spot is (displacement is not in phase with the heavy spot and max displacement lags 90° behind the driving force of the heavy spot).Based on some knowns of the system and the waveform observed on the scope, you can calculate how much weight needs to be added, as well as where it needs to be added.This was one of the labs included in the lab portion of an intermediate vibrations class at Cal Poly as part of my mech engineering coursework.While this is rather rudimentary, the labs are designed to ensure that you grasp the material as well as give you some real world experience ("Learn by Doing" is Cal Poly's motto).This particular lab exposed students to something they might do to during the process of product development.A perfect example of how this theory translates into a final product is a wheel balancing machine. In case you've never seen one here is a description: mount the wheel on the machines spindle, the machine spins it up to a very low rpm (relative to the RPM a wheel would see at highway speeds), Then the machine tells the operator to turn the wheel to a certain position and then add a specific amount of weight at that position. (And most likely different weights at other positions.Pretty cool tech that started life with a very simple setup and o scope.Sorry if this is a bit off topic, but wanted to show that oscilloscopes play a rather large role outside of pure electronics.Sent from my SM-G900V using Tapatalk

author: Circlotron
author_rank: Super Contributor
timestamp: January 06, 2017, 12:36:21 am
content: My area is car engine ignition systems.Connect an ignition coil output to 1500v worth of Zeners and 2kV reverse blocking diode. Measure int(volts*amps) and read the results in millijoules. One particular aftermarket capacitor discharge ignition manufacturer claims 100mJ spark energy and indeed their box does put out that much. What they don't tell you is that the energy in the coil leakage reactance that is subsequently recycled back into the 12vdc supply, and the huge losses in the recommended ignition coil, of the 100mJ presented to the primary only 38mJ comes out the secondary side. With a non-optimum coil it can be as low as 25mJ. A good modern inductive ignition measures as high as 100mJ. The CDI secondary voltage rise times are typically 10uS, nothing like the 1uS often claimed.

author: saturation
author_rank: Super Contributor
timestamp: January 16, 2017, 12:02:59 pm
content: Its more a timesaver, which is the only resource you can't get back, time. Some calculations can be too involved and making an rough estimate is expedient, such as power calculations, but with scope functions, you needn't estimate. But, IMHO regardless of which function you use, if you buy a DSO with math functions specified in the spec sheet, it should perform these math functions as expected, naturally within the specified accuracy stated on the spec sheet.Quote from: JPortici on January 05, 2017, 05:20:19 am

author: MrW0lf
author_rank: Frequent Contributor
timestamp: February 07, 2017, 10:13:48 am
content: Managed to substantially improveArduino / PicoScope MSO ADAC scripts & pattern generatorsand ironed out little bugs with formulas. Guess could call it "finished product" now. Cannot modify/fix old postsso have to upload here:Arduino Uno ADAC listening to signal gen @ 59kSa/sArduino_Uno__ADC__59kSa.zipLowPass((128*D7+64*D6+32*D5+16*D4+8*D3+4*D2+2*D1+1*D0)/256/0.996,15000)*4.8Arduino Uno 2398Hz 8x8bit sine patternArduino_Uno__ADC__8x8bit_2398Hz_sine_pattern.zipLowPass((128*D7+64*D6+32*D5+16*D4+8*D3+4*D2+2*D1+1*D0)/256/0.996,15000)-0.5Arduino Due ADAC listening to signal gen @ 687kSa/s, non-time-skewed CH2 for comparisonArduino_Due__ADC__687kSa.zipLowPass((2048*D11+1024*D10+512*D9+256*D8+128*D7+64*D6+32*D5+16*D4+8*D3+4*D2+2*D1+1*D0)/4096/0.9998,175000)*3.33Arduino Due 1456Hz 12x12bit sine patternArduino_Due__ADC__12x12bit_1465Hz_sine_pattern.zipLowPass((2048*D11+1024*D10+512*D9+256*D8+128*D7+64*D6+32*D5+16*D4+8*D3+4*D2+2*D1+1*D0)/4096/0.9998,175000)-0.5Note that formulas are not optimized (...4096/0.9998... etc), this to give clear picture what does what. Voltage divider not used.

author: MrW0lf
author_rank: Frequent Contributor
timestamp: September 28, 2018, 09:46:54 am
content: I tried to help someone over atPico forumwith some math stuff that ended up with creating excessive test environmentThought share it here also maybe useful to someone. Subject is taking apart this formula:acos(integral(A*B)/(sqrt(integral(A^2))*sqrt(integral(B^2))))/Pi*180Which does give phase shift between two signals with matching wfm shape. On closer inspection it turned out to be based on calculation ofpower.Interesting quote from wiki:QuoteScreenshot of test setup,saved env attached:Input signal:115V AC RMS180mA AC RMSCurrent lagging by45°On theleft screenscreen measurements are taken by built-in measurements except phase which is my own formula:((((atan(1/tan(pi*(A/10000)))/pi)+(A/10000))*-((atan(1/tan(pi*(B/10000)))/pi)+(B/10000)))+0.25)/0.002777777...which converts phase to PWM that will give better reading than discussed formula when averaged (incl. on subsampled signals).On themiddle screen:TRMS(A) = sqrt(integral(A^2)/T)TRMS(B) = sqrt(integral(B^2)/T)P(A*B) = integral(A*B)/TMAX(P(A*B))) = sqrt(integral(A^2))*sqrt(integral(B^2)))/ToldPhase(A,B) = acos(integral(A*B)/(sqrt(integral(A^2))*sqrt(integral(B^2))))/Pi*180On theright screensome inner components are visualized and formulas written on screenshot.Now inner workings of formula are exposed and can see it is based on dividing current instantaneous power with maximum possible instantaneous power (zero phase shift) and converting reading to degrees at each sample point.For reference, since example iswith sinesthen sanity check:115*0.18*cos(45*Pi/180)=14.64W115*0.18=20.7Wacos(14.64/20.7)/Pi*180=45°Edit, sanity check 2 with WolframAlpha:integrate (115*sin(x)) * (0.18*sin(x-45pi/180)) * (2/pi); 0 to piintegrate (115*sin(x)) * (0.18*sin(x)) * (2/pi); 0 to piSuch hands-on visualizations with physical setups involved have helped myself also a lot to get back on track with math I mostly ignored in school (largely due to math teacher nice (.)(.) of course).

author: macboy
author_rank: Super Contributor
timestamp: September 28, 2018, 07:02:30 pm
content: If you have access to a very fast-rise step (square wave) generator then you can almost instantaneously measure the frequency response of the scope from DC to its bandwidth limit. You can do the same for any device under test between the step generator and the scope (a filter, etc).This requires measuring the step, averaging that to remove noise, taking the derivative of the average, and finally taking the FFT of that derivative.In the following, trace C is the frequency response of the scope.Refer to my older post for more details.

author: schmitt trigger
author_rank: Super Contributor
timestamp: September 28, 2018, 07:34:41 pm
content: View transformer's hysteresis curves. I actually published this trick back in 2001 in Electronics World.

author: bson
author_rank: Unknown
timestamp: September 29, 2018, 12:21:50 am
content: Quote from: macboy on September 28, 2018, 07:02:30 pmThat's really nice!And, of course, not just the scope... you could use that technique tomeasureeyeball the frequency response of any DUT.

author: David Hess
author_rank: Super Contributor
timestamp: September 29, 2018, 03:12:40 am
content: Quote from: macboy on September 28, 2018, 07:02:30 pmAnd if the FFT also returns the phase information, then aligning the trigger correctly will produce a full Bode plot with amplitude and phase.

author: Smokey
author_rank: Super Contributor
timestamp: September 29, 2018, 03:36:17 am
content: Hello Everyone... I'm just starting out (but I'm SUPER excited about electronics!) and I heard on a web form that beginners should get an analog oscilloscope for their first scope so I picked up a Tek 465 for a really good deal. None of the knobs are missing! Here's a picture!Anyways... All this math channel talk sounds really interesting, but I'm having a really hard time trying to figure out how to get my Tek 456 math functions to work.Can someone please help me find the FFT button on my scope.. I've looked everywhere!!Thanks!

author: bsfeechannel
author_rank: Super Contributor
timestamp: September 29, 2018, 05:09:32 am
content: I used AxB in this video to calculate the instant power and derive the real power consumed by the isolation transformer I built a while ago. Since my scope is a Rigol DS1052E, I had to calculate the integral using the old school technique of measuring the area under the curve by hand..In this other video I used A-B to get a three-phase reading out of a car alternator, using the only two channels my Rigol has.In the video I just posted today I used FFT. So even with a humble scope like the venerable Rigol DS1052E, math is quite a handy tool.

author: dazz1
author_rank: Frequent Contributor
timestamp: September 29, 2018, 08:58:46 am
content: Quote from: Smokey on September 29, 2018, 03:36:17 amYou will find it is the grey, white or red knob. Occasionally it is the silver one but in all cases they may or may not have numbers and letters. On this particular model of scope, the FFT knob is not actually called FFT. Often it is easier to find the correct knob with all the lights out and with the room is in complete darkness. If you have any further questions, feel free to ask someone else. Hope this all helps in your quest.

author: MrW0lf
author_rank: Frequent Contributor
timestamp: September 29, 2018, 12:09:32 pm
content: Quote from: macboy on September 28, 2018, 07:02:30 pmI wonder if any of the low- to midrange knobbed DSOs could do that? I can dot it both on AD2 (required GUI script) and Picos (required custom math).Quote from: Smokey on September 29, 2018, 03:36:17 amYou are not missing a knob but magic mushrooms. Back in the wild days one would consume them until reaching state of free conversion between time and frequency domains.

author: David Hess
author_rank: Super Contributor
timestamp: September 30, 2018, 04:30:23 am
content: Quote from: MrW0lf on September 29, 2018, 12:09:32 pmNone that I know of. Most mid range DSOs cannot either. Some 20+ year old DSOs can though.Quote from: Smokey on September 29, 2018, 03:36:17 amFFTs on the Tektronix 465 requireoption 1401.

author: nctnico
author_rank: Super Contributor
timestamp: September 30, 2018, 11:11:02 am
content: Quote from: MrW0lf on September 29, 2018, 12:09:32 pmNot that I know of. On most scopes FFT is a seperate mode and not a math operation.

author: rstofer
author_rank: Super Contributor
timestamp: September 30, 2018, 04:26:03 pm
content: Quote from: MrW0lf on September 28, 2018, 09:46:54 amYour projects look like an excellent demo for Pico Scope! Which model are you using?My Analog Discovery is nice and it can be scripted but on its best day I'm not sure it will do the things you are doing. It's pretty clear my Tek 485 won't do anything other than add/subtract. The DS1054Z is a lot better but, if math is the issue, it's nowhere near what you are doing with the Pico Scope.I think I am beginning to want one!

author: MrW0lf
author_rank: Frequent Contributor
timestamp: September 30, 2018, 06:33:41 pm
content: Quote from: rstofer on September 30, 2018, 04:26:03 pmHi, thanks for kind words, I just did choose to help get low- to midrange scoping out of the dark ages, not because this is easy, but because it is hardFighting with most fierce bugs hidden deep in the math core lair and measuring thins far beyond measureOver the time I had several models. Phase formula investigation was done on oldest 25MHz 2205. So all that circus was working on top of 2ch scope with 16k of memoryWhen need more power I have 2408B 4ch 100MHz 128MS and for ultimate challenges something bit faster also. Considering what toys you have there I would not look for something ordinary but perhaps more specialized. 5000D FlexRes is 8...16bit but need read specs carefully because higher bit modes drop in sampling rate. Then there is 4444 differential 1000V CAT III. 4000 series has other specialized scopes also, for example 8 channel non-differential.If compare to AD2 they similar yet quite different. Software in general is much easier to use for "normal" tasks. There are special modes (ETS, DPO, rapid sequential). Main mode I would call "analytical" and this similar to AD2 only operation mode in its pros and cons vs ordinary knobbed DSO. Creating complex scoping environment with many windows is much easier with Pico and all the zooming etc more handy. However in-GUI post-processing wise one is "limited" to math channels which do have bugs and tricks that need to know if doing heavy stuff. Think that post-processing is main thing going for AD2 if directly compare. Scripting is scripting. You cannot do everything with just formulas. However raw power is of course not there with AD2 so for me it is mostly a learning tool. In fact just finishing little derivation/integration/phase angle scripts for it since there are no built in functions for that. As by product managed to do TDT. Will post these also sooner or later.

author: Scratch.HTF
author_rank: Regular Contributor
timestamp: October 02, 2018, 12:46:02 am
content: Following Ohm's Law, (Voltage / Current) calculates dynamic resistance at a given point and (Current * Voltage) calculates dynamic wattage at a given point (both are done using a current probe).And when you FFT dynamic AC wattage, you can get information on produced harmonics.

author: MrW0lf
author_rank: Frequent Contributor
timestamp: December 18, 2018, 04:46:39 pm
content: On some scopes one cannot manually set vertical reference level for pulse width calculation and some other functions. On my scope it is automatic and defaults to middle of the signal: positive_peak - (peak_to_peak / 2). Below is workaround for setting calculation reference level to 0V, so reference can be steered around with DC offset. Two functions for each case, one for scopes withabs(x)function, other without.Clip signal -100mV...+100mV:((abs(A-0.1)-(A-0.1))-(abs(A+0.1)-(A+0.1)))/-2+0.1((sqrt((A-0.1)*(A-0.1))-(A-0.1))-(sqrt((A+0.1)*(A+0.1))-(A+0.1)))/-2+0.1Some other potentially useful functions:Extract positive part from signal:(-abs(A)+A)/-2(-sqrt(A*A)+A)/-2Extract negative part from signal:(abs(A)-A)/-2(sqrt(A*A)-A)/-2As can seeLowPulseWidth(Clip)matches cursors on zero level.

author: vk6zgo
author_rank: Super Contributor
timestamp: December 19, 2018, 03:45:36 am
content: Quote from: Smokey on September 29, 2018, 03:36:17 amI don't know quite why earlier posters thought it was funny to tell you a lot of nonsense, but here is the answer to your question.On Analog Oscilloscopes, the maths functions are limited to "A-B" & "A+B" , where "A" & "B" denote two vertical channels.This was done in hardware, so the more complex mathematical functions would have been prohibitively costly to implement.With DSOs, all such functions can be done in firmware, in most cases, or loaded as software in some others.FFT also is something relatively easy to do in DSOs, & extremely difficult to do in Analog 'scopes.for the same reason.The FFT function in DSOs can be good, or quite poor, depending upon the implementation.A real Spectrum Analyser still offers superior performance.Some Analog 'scopes had SA "plugins"or adaptors as accessories, like the 4401 adaptor for your 465.

author: Smokey
author_rank: Super Contributor
timestamp: December 19, 2018, 04:47:07 am
content: Quote from: vk6zgo on December 19, 2018, 03:45:36 am.... Because their sarcasm detectors were set a little more sensitive than yours

author: vk6zgo
author_rank: Super Contributor
timestamp: December 19, 2018, 07:26:49 am
content: Quote from: Smokey on December 19, 2018, 04:47:07 amYour posting sounded so much like many ones we get, so the sarcasm detector didn't pick it up in the noise.The master stroke was "disappearing" for a while, exactly as a knowledge challenged "noob" would.That convinced me.-----Well Played!