From: GAURAV on 29 Apr 2010 16:50 Hello Eveyone, I am trying to get an ellipse passing through the four points I have which are not symmetric. So, I am using the equation (X-Xc)^2/(a^2) + (Y-Yc)^2/(b^2) =1 I have four points which wil go in X and Y of the equation above. Let the points be (a1,b1), (a2,b2), (a3,b3) and (a4,b4).. How do I get a,b,Xc and Yc from this?? Please help me out. Really appreciate.. Thanks, Gaurav
From: Roger Stafford on 29 Apr 2010 17:03 "GAURAV " <gsharda(a)engineering.uiowa.edu> wrote in message <hrcrc2$3me$1(a)fred.mathworks.com>... > Hello Eveyone, > > I am trying to get an ellipse passing through the four points I have which are not symmetric. > So, I am using the equation (X-Xc)^2/(a^2) + (Y-Yc)^2/(b^2) =1 > > I have four points which wil go in X and Y of the equation above. > Let the points be (a1,b1), (a2,b2), (a3,b3) and (a4,b4).. > > How do I get a,b,Xc and Yc from this?? > > Please help me out. Really appreciate.. > > Thanks, > Gaurav Are you certain the ellipse you are looking for has its major and minor axes aligned with the x and y axes? If not, a minimum of five points is necessary. Roger Stafford
From: GAURAV on 29 Apr 2010 17:21 Hi Roger, Thanks for your reply.. Actually its an assumption I am making. I have two curves(orthogonal to each other) aligned in 3D ( not necessarily symmetrical ). The height (along Z axis) is the same. So, when I cut a slice for some Z, I have four points (two from each curve). Now I need to construct a volume from these two views. So from each slice I am trying to fit in an ellipse. I hope this makes sense. So, now I have four points which pass through ellipse and ellipse should not go out of this bound . So, I am looking to solve the ellipse equation and try to find out of the a,b,xc and yc required for the ellipse with angle=0. Can you suggest something? Regards, Gaurav.
From: GAURAV on 29 Apr 2010 17:22 Hi Roger, Thanks for your reply.. Actually its an assumption I am making. I have two curves(orthogonal to each other) aligned in 3D ( not necessarily symmetrical ). The height (along Z axis) is the same. So, when I cut a slice for some Z, I have four points (two from each curve). Now I need to construct a volume from these two views. So from each slice I am trying to fit in an ellipse. I hope this makes sense. So, now I have four points which pass through ellipse and ellipse should not go out of this bound . So, I am looking to solve the ellipse equation and try to find out of the a,b,xc and yc required for the ellipse with angle=0. Can you suggest something? Regards, Gaurav.
From: Roger Stafford on 29 Apr 2010 18:16 "GAURAV " <gsharda(a)engineering.uiowa.edu> wrote in message <hrct9s$bpa$1(a)fred.mathworks.com>... > Hi Roger, > Thanks for your reply.. > > Actually its an assumption I am making. > I have two curves(orthogonal to each other) aligned in 3D ( not necessarily symmetrical ). > The height (along Z axis) is the same. So, when I cut a slice for some Z, I have four points (two from each curve). > Now I need to construct a volume from these two views. So from each slice I am trying to fit in an ellipse. I hope this makes sense. > > So, now I have four points which pass through ellipse and ellipse should not go out of this bound . > So, I am looking to solve the ellipse equation and try to find out of the a,b,xc and yc required for the ellipse with angle=0. > > Can you suggest something? > > Regards, > Gaurav. For the four-point problem you can avoid using one of the non-linear methods by writing your equation in the following linear form. Then use 'svd' to determine the five unknown coefficients: A*x^2 + C*y^2 + D*x + E*y + F = 0 Do this: x = [a1;a2;a3;a4]; y = [b1;b2;b3;b4]; M = [x.^2,y.^2,x,y,ones(4,1)]; [U,S,V] = svd(M); A = V(1,5); C = V(2,5); D = V(3,5); E = V(4,5); F = V(5,5); The fifth column of V has your desired coefficients. These five coefficients should satisfy the above equation. By completion of the squares in the equation and dividing by the appropriate value you can then transform it into your original form and thereby determine a, b, xc, and xc. By way of explanation, this fifth column is the one corresponding to the zero-valued singular value of the matrix M, which causes it to be a solution to the equation. There is bound to be at least one singular value because the number of rows in M is less that its number of columns, and 'svd' always puts the least singular value in the last column - the fifth in this case. Roger Stafford
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: SOLVE 4 NONLINEAR EQUATIONS (HELP PLEASE) Next: Using interp1 for timeseries data |