Given that I know the values of the parametric equation of a tiltet ellipse:
$$x(α)=R_x\cos(α)\cos(θ)−R_y\sin(α)\sin(θ)$$ $$y(α)=R_x\cos(α)\sin(θ)+R_y\sin(α)\cos(θ)$$
with $R_x,R_y$ as the mayor/minor axis and $θ$ as the tilt angle. How do I get the parameters of an identical Lissajous Curve defined as:
$$x(α) = A\sin(\alpha+\varphi/2)$$ $$y(α) = B\cos(\alpha-\varphi/2))$$
with $A,B$ beeing the amplitude and $φ$ beeing the phase difference between $x,y$?
For example: If I generate an Lissajous Courve with $$A = 8000, B = 6000, \varphi = \pi/8$$ and then fit the ellipse I receive $$R_x = 1.709920878624523e+04, R_y = 1.037386422141691e+04, θ = -0.459778519549457$$
How would I calculate my original $A,B,\varphi$ based on the fitted values?
Thank you very much!
The target ellipse has the form
$ r^T Q r = 1$
where $Q$ is a symmetric positive definite matrix, that can be factored as
$ Q = R D R^T $
with $R = \begin{bmatrix} \cos \theta && - \sin \theta \\ \sin \theta && \cos \theta \end{bmatrix} $
and $D^{-1} = \begin{bmatrix} R_x^2 && 0 \\ 0 && R_y^2 \end{bmatrix} $
Now, the Lissajous curve is given by
$ \begin{bmatrix} x(t) \\ y(t) \end{bmatrix} = \begin{bmatrix} A \sin(t + \varphi/2 )\\ B \cos( t - \varphi/2 ) \end{bmatrix} = \cos(t) \begin{bmatrix} A \sin(\varphi/2) \\ B \cos(\varphi/2) \end{bmatrix} + \sin(t) \begin{bmatrix} A \cos(\varphi/2) \\ B \sin(\varphi/2) \end{bmatrix} $
Define the unit vector $u = \begin{bmatrix} \cos(t) \\ \sin(t) \end{bmatrix} $
And the matrix
$ G = \begin{bmatrix} A \sin(\varphi/2) && A \cos(\varphi/2) \\ B \cos(\varphi/2) && B \sin(\varphi/2) \end{bmatrix} $
And the point
$ P = \begin{bmatrix} x(t) \\ y(t) \end{bmatrix} $
Then
$ P = G u $
so that
$ u = G^{-1} P $
Since $u^T u = 1 $ , then
$ P^T G^{-T} G^{-1} P = 1 $
Note that
$ G = \begin{bmatrix} A && 0 \\ 0 && B \end{bmatrix} \begin{bmatrix} \sin(\varphi/2) && \cos(\varphi/2) \\ \cos(\varphi/2) && \sin(\varphi/2) \end{bmatrix} $
Therefore,
$G^{-1} = \begin{bmatrix} \sin(\varphi/2) && \cos(\varphi/2) \\ \cos(\varphi/2) && \sin(\varphi/2) \end{bmatrix}^{-1} \begin{bmatrix} A && 0 \\ 0 && B \end{bmatrix} ^{-1}$
$G^{-T} = \begin{bmatrix} A && 0 \\ 0 && B \end{bmatrix} ^{-1} \begin{bmatrix} \sin(\varphi/2) && \cos(\varphi/2) \\ \cos(\varphi/2) && \sin(\varphi/2) \end{bmatrix}^{-1} $
Hence, carrying out the multiplication, we obtain,
$ G^{-T} G^{-1} = \dfrac{1}{\cos^2(\varphi)} \begin{bmatrix} A^{-1} && 0 \\ 0 && B^{-1} \end{bmatrix} \begin{bmatrix} 1 && - \sin(\varphi) \\ - \sin(\varphi) && 1 \end{bmatrix} \begin{bmatrix} A^{-1} && 0 \\ 0 && B^{-1} \end{bmatrix}$
This simplifies to
$ Q = G^{-T} G^{-1} = \dfrac{1}{\cos^2(\varphi)} \begin{bmatrix} A^{-2} && - A^{-1} B^{-1} \sin(\varphi) \\ - A^{-1} B^{-1} \sin(\varphi) && B^{-2} \end{bmatrix} $
Now, matrix $Q$ is known from $R_x, R_y$ and $\theta$ as in the formula above (equation $(2)$).
So now we have
$ K_1 = \dfrac{Q_{11}}{Q_{22}} = \dfrac{B^2}{A^2} $
and
$ K_2 = \dfrac{Q_{11}}{Q_{12}} = - \dfrac{B}{A \sin(\varphi) } $
Hence,
$ \sin(\varphi) = - \dfrac{ \sqrt{K_1} }{ K_2 } $
Now we have $\varphi$. Next,
$ Q_{12} = - \dfrac{ \sin(\varphi) }{\cos^2(\varphi) A B } $
So
$ A B = - \dfrac{ \sin(\varphi) }{ Q_{12} \cos^2(\varphi) } $
Therefore,
$ B^2 = \dfrac{ K_2 \tan^2(\varphi)}{ Q_{12} } $
Once we get $B$ from this, we can calculate $A$.
Now in your example, you have
$ R_x = 1.709920878624523 \times 10^4, R_y=1.037386422141691 \times 10^4,\theta=0.459778519549457 $
Using equations $(2), (3), (4)$, we arrive at
$ Q = 10^{-9} \begin{bmatrix} 4.57646 && 2.33511 \\ 2.33511 && 8.13592 \end{bmatrix} $
From this
$ K_1 = \dfrac{4.57646}{8.13592} = 0.5625 $
$K_2 = \dfrac{ 4.57646 }{ 2.33511} = -1.9598477 $
Hence
$ \sin(\varphi) = -\dfrac{ \sqrt{0.5625}}{-1.9598477} = 0.382683 $
From which we calculate $\varphi = \dfrac{\pi}{8} $
Now,
$ B = \sqrt{ \dfrac{ K_2 \tan^2(\varphi) }{Q_{12}} } = \sqrt{\dfrac{ -1.9598477 ( 0.17157287 ) }{ -2.33511 \times 10^{-9} }} = 12000$
And from the above formulas, we have
$ AB = - \dfrac{ \sin(\varphi) }{ Q_{12} \cos^2(\varphi) } = \dfrac{ 0.382683 }{ 0.85355339 \times 2.33511 \times 10^{-9} } = 192 \times 10^6 $
Hence,
$ A = \dfrac{ 192 \times 10^6 }{ 12 \times 10^3 } = 16000 $
The values reported in the OP are $A = 6000, B = 8000$. The values obtained are double that. The given values for $R_x$ and $R_y$ must be wrong.