Find points on an ellipse in the xy-plane given the quadratic equation using symbolic variables.
Show older comments
Hi,
I'm am trying to find points on an ellipse given a certain quadratic equation e.g. -0.0204*x^2 -0.0084*x*y + 0.5750*x - 0.0076*y^2 + 0.3871*y - 6.4044 = 0 . Here, x and y are symbolic the symbolic variables (syms x y).
This equation is generated using another script and is the projection of a rotated 3D-ellipsoid on the xy-plane. I need to find these points automatically, because I have to repeat this process countless times. My current code is shown below and I am using R2010a.
Thanks in advance!
% Rotation matrix
W = angle2dcm(123*pi/180, 234*pi/180, 23*pi/180);
% Center point ellipse
x0 = 10; y0=20; z0=20;
% Minor axis ellipse
a = 10; b = 5; c = 2;
% Diagonal matrix
D = [1/a^2 0 0; 0 1/b^2 0; 0 0 1/c^2];
% New rotated diagonal matrix
D2 = W*D*transpose(W);
x = sym('x'); y = sym('y');
Q = [x; y; 0];
U = [0; 0; 1];
C = [x0; y0; z0];
a2 = transpose(U)*D2*U;
a1 = (transpose(U)*D2*(Q-C)) + transpose(Q-C)*D2*U;
a0 = transpose(Q-C)*D2*(Q-C) - 1;
variableName = a1^2 - 4*a0*a2;
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!