0
$\begingroup$

I would like to receive some hint as to which algorithm could be used to compare two waveforms from an oscilloscope in XY mode, as shown in the image:

enter image description here

Note that the image shows a percentage difference (displayed in red) between the two curves (one yellow, one blue).

It is this percentage value that I would like to obtain.

I understand that the curves are produced point to point (x, y) and then a sequence of position data (x, y) is generated:

enter image description here

I believe that the algorithm would have to compare two data arrays.

Does anyone have any idea how to do this?

Thank you.

Edit: Following the formula of the video (Normalized Correlation), I believe that the result of comparison is interesting, my next step is to try to do it with a microcontroller to find out if it will have resources.

Note: After calculating the correlation for each axis, I multiplied the result of the axes and inverted the result, to show the difference. If this is not correct, please comment on any suggestions.

enter image description here

Ref.:

Normalized cross-correlation is also the comparison of two time series, but using a different scoring result. Instead of simple cross-correlation, it can compare metrics with different value ranges.

Source: https://anomaly.io/understand-auto-cross-correlation-normalized-shift/index.html

Edit (03/14/2021): In addition, the measurement is performed with a dedicated microcontroller and synchronized with the frequency of the sine wave, that is, the number of readings is fixed.

The basic circuit:

enter image description here

The name “Octopus” maybe doesn’t say anything alone but if you google it along the words “curve tracer” you will obtain thousands of result.In few words an “Octopus” curve tracer is a small circuit that used in conjunction with a scope allows to display the voltage across a component under test on horizontal (X) axis versus the current through that component on the vertical (Y) axis.A scope set to X-Y mode is required (most of them have this feature).

This circuit will produce a “signature” waveform on the oscilloscope to aid in the testing and analysis of shorts, opens, and leakage in just about any electronic component including resistors, capacitors, inductors, diodes,transistors and digital ICs too.Each component has a characteristic waveform (called “Lissajous” pattern), some examples:

enter image description here

Source: https://www.jammarcade.net/simple-component-tester-a-k-a-octopus-curve-tracer/

$\endgroup$
4
  • 1
    $\begingroup$ I found a video on Normalized Correlation, but I'm trying to confirm that this is the correct processing for the case. Source: youtube.com/watch?v=ngEC3sXeUb4 $\endgroup$ – user3394963 Mar 10 at 1:45
  • $\begingroup$ Working with any complex signals in hardware which is done with two real signals, one representing the real axis and the other representing the imaginary axis (I and Q) is an application where XY mode with an oscilloscope is used. And all related processing with visualizing complex signals on a complex plane. $\endgroup$ – Dan Boschen Mar 11 at 23:52
  • $\begingroup$ In the specific test done, was X the same for both waveforms? If not, what is X and what is Y for the actual signals? $\endgroup$ – Dan Boschen Mar 13 at 9:38
  • $\begingroup$ Hello @DanBoschen, I added more information in the post of the question, about the origin of the signal, in one axis it is voltage and in another axis it is current. $\endgroup$ – user3394963 Mar 14 at 10:20
1
$\begingroup$

You can't get the exact value because you don't know how log the signals spent at each stage.

Consider the case where you have two square with period 1, and shifted by $\delta$ compared to each other.

The XY plot will always be a rectangle with the width corresponding to the amplitude of the X signal and height corresponding to the amplitude of the Y signal. In other words, you have always the same input for your function to compute the correlation, while the correct output varies.

You still can get an idea of how similar two signals are, but it is not the signal cross correlation

$\endgroup$
4
  • $\begingroup$ exactly! Excellent example with the square wave. To refer to the circle example from the question: The signal displayed there is just $x=\sin(ft), y = \cos(ft)$. It works for any $f$. But if also works for "do that forward for 3 cycles, then backwards for 0.23456789 cycle, then hold both x and y still for 20 minutes, then go forward at 1.42 times the frequency". $\endgroup$ – Marcus Müller Mar 10 at 11:45
  • $\begingroup$ Interesting that answer. At the moment I do not know how to evaluate the answer, what I can comment on is that this signal in the image, originates from an injected wave, and that wave is pure sine. So I don't know if it would be possible to obtain a square. In addition, the measurement is performed with a dedicated microcontroller and synchronized with the frequency of the sine wave, that is, the number of readings is fixed. Thank you. $\endgroup$ – user3394963 Mar 11 at 12:26
  • $\begingroup$ The basic circuit can be seen at this link: qsl.net/kd7rem/img/test/octopus.gif Note: I am currently using a smartphone, and I was unable to add (edit) the question. $\endgroup$ – user3394963 Mar 11 at 13:25
  • $\begingroup$ Source: jammarcade.net/… $\endgroup$ – user3394963 Mar 11 at 13:26
0
$\begingroup$

To answer the OP's question, yes cross correlation could be used but I wouldn't recommend Vertical correlated to Horizontal but rather treat Vertical and Horizontal as one complex waveform which is then cross-correlated against all signatures to find the best match ($Y = H + jV$). If there were only 6 components that were consistent in their characteristic this would make possible sense as an identification approach, but given the variability for all the examples shown (such as the actual breakdown voltage for a zener diode, it's slope in the forward conducting region etc) this may be a good application for machine learning / pattern recognition. There is no synchronization between the captured signal and the patterns, but processing would be reduced by using the zero crossing around H with an early identification of the short circuit condition (no signal).

Given one axis is voltage and the other axis is current; with voltage on the horizontal axis the plot is the resistance versus voltage. If linear, the device is a simple resistor with the resistance higher as lower slopes (as given by Ohm's law). If non-linear, the device can be interpreted as a voltage controlled resistor.

The capacitor as shown is very dependent on the nature of the voltage but from the circuit now shown would be consistent and at a specific frequency; so this would determine the value of capacitance based on the magnitude of I vs V which would be the elongation of the ellipse (within the range of capacitors for a 60 Hz signal). Similarly the inductance can be determined; the inductor rotates counter-clockwise and the capacitor clock-wise.

The IV curves as shown are often used in transistor and diode characterization as an instrument called a curve tracer. There are more details on this here:

https://www.rs-online.com/designspark/how-to-use-an-oscilloscope-as-a-curve-tracer

$\endgroup$
5
  • $\begingroup$ Hello, sorry, I understand that you may have been excited about how the equipment works, but the question is about comparing the V-I curve. In this case, a sample is saved, and then used to compare with another reading. That is why I did not inform the electronic circuit that originated the curve. But as another answer suggested the possibility of a square curve, so I added more information. Anyway, thank you for your time in responding. $\endgroup$ – user3394963 Mar 15 at 13:56
  • $\begingroup$ @user3394963 Yes my response in answer to that is that this is basically informing what the voltage controlled resistance may be for static IV measurements and its use in comparing capacitors (and equally inductors) is limited unless you specify the frequency at which the sweep is made. I hope that helps! $\endgroup$ – Dan Boschen Mar 15 at 14:01
  • $\begingroup$ Yes, the sample rate must be proportional to the frequency. And the frequency of the sine wave can be adjusted, but during the capture of the curve, it remains fixed. The comparison should be made only with curves obtained from the sine wave of the same frequency. This operation is called 2D (x, y). But there is another mode of operation that is called 3D. In this 3D, a sequence of curves is captured, and each curve is obtained from a wave frequency. So, for example, we have a sequence of curves obtained from 100Hz to 1kHz, with a 50Hz step. This generates a very interesting signature. $\endgroup$ – user3394963 Mar 15 at 18:43
  • $\begingroup$ And an inductor will rotate counter-clockwise while the capacitor will rotate clockwise. Regarding identification algorithms that would have nothing to do really with the visualization of plotting on an XY graph, does it? The plotting is just visual $\endgroup$ – Dan Boschen Mar 15 at 19:37
  • $\begingroup$ Well, I used the normalized cross correlation formula, between Ax and Bx, then another calculation between Ay and By, in the same way that was described in the spreadsheet (already added in the question post). But I had to change the multiplication factor, from 100 to 50. This way I got a value from 0 to 100%. Even if the lag between waves varies up to 180 degrees (-90~+90), the comparison value seems to be working well. But if the lag angle between the waves exceeds 180 degrees, a false comparison occurs, where the curves overlap visually, but the calculations say they are different. $\endgroup$ – user3394963 Mar 16 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.