How to transform a ellipse to circle

31 visualizaciones (últimos 30 días)
mina sh
mina sh el 16 de Jul. de 2020
Respondida: Image Analyst el 17 de Jul. de 2020
I have some data which looks like it can be fitted with an ellips. However, I want to transform it so it would be in a cricle.How can I do it?

Respuestas (2)

Matt J
Matt J el 16 de Jul. de 2020
If the equation for the ellipse is
x.'*Q*x =1
then you simply take the cholesky decomposition of the 2x2 matrix Q,
L=chol(Q)
and make the change of variables y=L*x. The equation for y is
y.'y=1
which is the equation for a circle of radius 1.
  15 comentarios
Bruno Luong
Bruno Luong el 17 de Jul. de 2020
Editada: Bruno Luong el 17 de Jul. de 2020
Now that looks right.
One think you must pay attention is the determinant of V.
I don't know where it comes from but the determinant must be +/-1. Some algorithm return V with det=+1, other doesn't specify the sign of V.
If det(V)==-1 you could get the transformation that flips your plots (however still maps the ellipse to a circle), like looks at the mirror. If that kind of transformation is problem for you, just reverse the sign of one colume of V, then do the rest identical.
mina sh
mina sh el 17 de Jul. de 2020
Editada: mina sh el 17 de Jul. de 2020
Thanks Bruno. You helped a lot. I checked the deteminant of V and it is +1.

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 17 de Jul. de 2020
Are you just worried that your x and y are distorted, like digitally it's roughly round but because of the shape of the figure window and axes inside it, the shape looks stretched? If so experiment around with
axis equal
You might also want to play with xlim() and ylim()

Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by