3

Suppose I have measurements of two signals

V = V(t) and U = U(t) 

that are periodic in time with a phase difference between them. When plotted against each other in a graph V vs U they form a Lissajous figure, and I want to calculate the area inside it.

Is there an algorithm for such calculation?

I would like to solve this problem using Python. But a response in any language or an algorithm to do it will be very appreciated.

Examples of V and U signals can be generated using expressions like:

V(t) = V0*sin(2*pi*t) ; U(t) = U0*sin(2*pi*t + delta)

Figure 1 shows a graph of V,U vs t for V0=10, U0=5, t=np.arange(0.0,2.0,0.01) and delta = pi/5.

img1

And Figure 2 shows the corresponding Lissajous figure V vs U.

img2

This is an specific problem of a more general question: How to calculate a closed path integral obtained with a discrete (x_i,y_i) data set?

Spektre
  • 49,595
  • 11
  • 110
  • 380
  • You can use a polar area integral in the situation where `t` is related to the polar angle. In the general situation, you need to sort the points by polar angle and add up the areas of the triangles formed by each pair of adjacent points and the origin – meowgoesthedog Sep 01 '17 at 18:40
  • 3
    If you're asking for area of any Lissajous figure then you have to define what exactly do you mean by area for curves like this https://en.m.wikipedia.org/wiki/Lissajous_curve#/media/File%3ALissajous_curve_5by4.svg – algrid Sep 01 '17 at 23:57
  • Yes @algrid, it is hard to define what is the area of this kind of Lissajous curve (my guess is that the outer contour defines the area). But for curves generated using V and U signals with the same frequency (what I've asked) we don't have this problem. – Fellype do Nascimento Sep 21 '17 at 14:42

3 Answers3

3

To find area of (closed) parametric curve in Cartesian coordinates, you can use Green's theorem (4-th formula here)

A = 1/2 * Abs(Integral[t=0..t=period] {(V(t) * U'(t) - V'(t) * U(t))dt})

But remember that interpretation - what is real area under self-intersected curves - is ambiguous, as @algrid noticed in comments

MBo
  • 77,366
  • 5
  • 53
  • 86
2

for the outer most curves area of usual Lissajous shapes I would try this:

  1. find period of signal

    so find T such:

    U(t) = U(t+T)
    V(t) = V(t+T)
    
  2. sample data on t=<0,T>

    I would use polar coordinate system with center equal to average U,V coordinate on interval t=<0,T> and call it U0,V0. Convert and store the data in polar coordinates so:

    a(t)=atan2( V(t)-V0 , U(t)-U0 )
    r(t)=sqrt( (U(t)-U0)^2 + (V(t)-V0)^2 )
    

    and remember only the points with max radius for each angle position. That can be done either with arrays (limiting precision in angle) or geometricaly by computing polyline intersection with overlapping segments. and removing inside parts.

  3. Compute the area from sampled data

    So compute the the area by summing the pie triangles for each angular position covering whole circle.

This may not work for exotic shapes.

Spektre
  • 49,595
  • 11
  • 110
  • 380
1

Both solutions above - by @MBo and by @Spektre (and @meowgoesthedog in the comments) - works fine. Thank you guys.

But I found another way to calculate the area A of an elliptical Lissajous curve: use the A = Pi*a*b formula (a and b are, respectively, the major and minor semi axis of the ellipse).

Steps:

1 - Find the period T of the V (or U) signal;

2 - In the time interval 0<t<T:

2.a - calculate the average values of V and U (V0 and U0), in order to determine the center of the ellipse;

2.b - calculate the distance r(t) from the point (V0,U0) using:

r(t)=sqrt( (U(t)-U0)^2 + (V(t)-V0)^2 )

3 - Find a and b values using:

a = max(r(t)); b = min(r(t))

4 - calculate A: A = Pi*a*b

The Lissajous curves will always be elliptical if the U,V signals are sinusoidal-like and have the same frequency.

Seizing the opportunity, I will propose a solution for the case where the V,U signals are triangular and have the same frequency. In this case, the Lissajous curve will be a parallelogram, then one can calculate its area A using A = 2*|D|*|d|*sin(q), where |D| and |d| are, respectively, the length of major and minor semi diagonals of the parallelogram and q is the angle between the vectors D and d.

Repeat steps 1 and 2 for the elliptical case.

In step 3 we will have:

|D| = max(r(t)) = r(t1); |d| = min(r(t)) = r(t2)

4' - Obtain t1 and t2 and use them to get the coordinates (V(t1)=V1,U(t1)=U1) and (V(t2)=V2,U(t2)=U2). Then the vectors D and d can be written as:

D=(V1,U1)-(V0,U0); d=(V2,U2)-(V0,U0)

5' - Calculate the angle q between D and d;

6' - Perform the calculation of A: A = 2*|D|*|d|*sin(q)