1

let's say I have 6 points (x,y)and the general equation for a conic section Ax^2+Bxy+Cy^2+Dx+Ey+F=0. is there a way I can find A,B,C,D,E,F?

I know that for a linear equation I can solve this with a matrix but it won't seem to work since all of the equation are equal to 0 any help on this topic would be appreciated

Shiko
  • 2,448
  • 1
  • 24
  • 31
Liana78
  • 25
  • 6
  • Your question is not related to programming, please move it to https://math.stackexchange.com/ – Shiko Mar 01 '18 at 21:34
  • @Shiko actually I'm looking for a way to do it using matlab...I know how the equations can be solved by hand but I can't seem to find the right functions to do so in matlab – Liana78 Mar 01 '18 at 21:38
  • Have you tried this function `fit_conicLMA(XY,ParAini,LambdaIni)` reference https://au.mathworks.com/matlabcentral/fileexchange/32108-fitting-a-conic-to-a-given-set-of-points-using-levenberg-marquardt-method – Shiko Mar 01 '18 at 21:43
  • @Shiko yes,I have tried to understand how it works but I can't seem to get it right,it looks like I have to supply the A,B,C,D,E,F values – Liana78 Mar 01 '18 at 22:18

1 Answers1

1

Maybe this (x and y are column vectors):

M=[x.^2, x.*y, y.^2, x, y, x*0+1];
[U,S,V]=svd(M)
Sol=V(:,end) %A,B,C,D,E,F
Mendi Barel
  • 3,350
  • 1
  • 23
  • 24