Conversion from Standard Ellipse Function to General Ellipse Function

667 Views Asked by At

I wonder if anyone can assist/show me how to complete this task...

I have the following equation which models a dual axis magnetic field:

$$\begin{equation} B_{H}^2 = B_x^2 + B_y^2 \tag{1}\end{equation}$$

Where $ B_{H}^2 $ is the 'ideal' earths magnetic field, $ {B}_{x}, {B}_{y} $ are the 'ideal' x and y axis mag. field values.

Now, the 'actual' measured fields can be given by:

$$\begin{equation} \hat{B}_x = aB_x + x_0 \tag{2}\end{equation}$$ $$\begin{equation} \hat{B}_y = b\left(B_y\cos{(p)} + B_x\sin{(p)}\right) + y_0\tag{3} \end{equation}$$

Where, $ a, b $ are scaling factors for each axis, $ p $ is an angular offset and $ x_0, y_0 $ are bias offset values.

Now, solving for $ B_x $ in $ (2) $ gives:

$$ B_x = \left(\frac{\hat{B}_{x} - x_{0}}{a}\right) $$

Plugging into $ (3) $ and solving for $ B_y $ gives:

$$ B_y = \frac{\left(\frac{\hat{B}_y - y_0}{b} - \frac{\left(\hat{B}_x - x_0\right) * \sin{(p)}}{a}\right)}{\cos{(p)}} $$

Which simplified gives:

$$ B_y = \frac{\left(a\hat{B}_y + ay_0 + \hat{B}_x\sin{(p)}b - \sin{(p)}b^2\right)}{ab\cos{(p)}} $$

Plugging $ B_x, B_y $ into $ (1) $ gives:

$$ B_{H}^2 = \left(\frac{\hat{B}_{x} - x_{0}}{a}\right)^2 + \left(\frac{\left(a\hat{B}_y + ay_0 + \hat{B}_x\sin{(p)}b - \sin{(p)}b^2\right)}{ab\cos{(p)}}\right)^2 $$

Now this is the bit I can't seem to figure out... Apparently this can written in the form of a shifted, distorted ellipse with the general ellipse form:

$$ A\hat{B}_x^2 + B\hat{B}_x\hat{B}_y + C\hat{B}_y^2 + D\hat{B}_x + E\hat{B}_y + F = 0 $$

Can anyone point me in the right direction as to how to do this? I've been trying all day with zero success, I could put my attempts here but I would be here all day! I think it's the reversal of Completing the Squares but I'm not 100% sure.

Any help appreciated, Thankyou.

Carrying on from the above and based upon Grahams observation.

Subtract $ B_H^2 $ from both sides gives:

$$ \left(\frac{\hat{B}_{x} - x_{0}}{a}\right)^2 + \left(\frac{\left(a\hat{B}_y + ay_0 + \hat{B}_x\sin{(p)}b - \sin{(p)}b^2\right)}{ab\cos{(p)}}\right)^2 - B_H^2 = 0 $$

Removing the denominators gives:

$$ \left(\hat{B}_x-x_0\right)^2\left(ab\cos(p)\right)^2 + a^2\left(a\hat{B}_y+ay_0+\hat{B}_x\sin(p)b-\sin(p)b^2\right)^2-B_H^2a^2\left(ab\cos(p)\right)^2 = 0 $$

Expanding the first term $ \left(\hat{B}_x-x_0\right)^2\left(ab\cos(p)\right)^2 $ gives:

$$ \left(\hat{B}_x^2-2\hat{B}_xx_0+x_0^2\right)\left(ab\cos(p)\right)^2 = \hat{B}_x^2\left(ab\cos(p)\right)^2-2\hat{B}_xx_0\left(ab\cos(p)\right)^2+x_0^2\left(ab\cos(p)\right)^2 \qquad\qquad\mathbf{(4)}$$

Expanding the second term gives:

$$ a^2\left(\left(a\hat{B}_y+ay_0+\hat{B}_x\sin(p)b-\sin(p)b^2\right)\left(a\hat{B}_y+ay_0+\hat{B}_x\sin(p)b-\sin(p)b^2\right)\right) \\ = a^2\left(a^2\hat{B}_y^2+a^2y_0\hat{B}_y+\hat{B}_y\hat{B}_xab\sin(p)-\hat{B}_yab^2\sin(p)+\hat{B}_ya^2y_0+a^2y_0^2+\hat{B}_x^2aby_0\sin(p)-ab^2y_0\sin(p)+\hat{B}_x\hat{B}_yab\sin(p)+\hat{B}_xaby_0\sin(p)+\hat{B}_x^2\sin^2(p)b^2-\hat{B}_xb^3\sin^2(p)-\hat{B}_yab^2\sin(p)-ab^2y_0\sin(p)-\hat{B}_xb^3\sin^2(p)+\sin^2(p)b^4\right) $$

Collecting the terms and multiplying by $ a^2 $ gives:

$$ \hat{B}_x^2\left(a^2b^2\sin^2(p)\right)+\hat{B}_x\hat{B}_y\left(2a^3b\sin(p)\right)+\hat{B}_y^2\left(a^4\right)+\hat{B}_x\left(2a^3by_0\sin(p)-2a^2b^3\sin^2(p)\right)+\hat{B}_y\left(2a^2y_0-2a^2b^2\sin(p)\right)+a^4y_0^2-2a^3b^2y_0\sin(p)+a^2b^4\sin^2(p)\qquad\qquad \mathbf{(5)}$$

Combining $ \mathbf{(4)}, \mathbf{(5)}, $ and $ -B_H^2a^2\left(ab\cos(p)\right)^2 $ gives:

$$ \hat{B}_x^2\left(a^2b^2\right)+\hat{B}_x\hat{B}_y\left(2a^3b\sin(p)\right)+\hat{B}_y^2\left(a^4\right)+\hat{B}_x\left(2a^3by_0\sin(p)-2a^2b^3\sin^2(p)-2a^2b^2x_0\cos^2(p)\right)+\hat{B}_y\left(2a^2y_0-2a^2b^2\sin(p)\right)+a^4y_0^2-2a^3b^2y_0\sin(p)+a^2b^4\sin^2(p)+x_0^2\left(ab\cos(p)\right)^2-B_H^2a^4b^2\cos^2(p) $$

So finally, we have:

$$ A=a^2b^2 \\ B=2a^3b\sin(p) \\ C=a^4 \\ D=2a^3by_0\sin(p)-2a^2b^3\sin^2(p)-2a^2b^2x_0\cos^2(p) \\ E=2a^2y_0-2a^2b^2\sin(p) \\ F=a^4y_0^2-2a^3b^2y_0\sin(p)+a^2b^4\sin(p)+x_0^2\left(ab\cos(p)\right)^2-B_H^2a^4b^2\cos^2(p) $$

After tidying up a little gives:

$$ A=b^2 \\ B=a\left(2b\sin(p)\right) \\ C=a^2 \\ D=\left(2aby_0\sin(p)-2b^3\sin^2(p)-2b^2x_0\cos^2(p)\right) \\ E=\left(2y_0-2b^2\sin(p)\right) \\ F=\left(a^2y_0^2-2ab^2y_0\sin(p)+b^4\sin(p)+x_0^2b^2\cos^2(p)-B_H^2b^2\cos^2(p)\right) $$

Does this look ok?