Could you please help me with the following question: I want to solve a second order equation with two unknowns and use the results to plot an ellipse. Here is my function:
fun = @(x) [x(1) x(2)]*V*[x(1) x(2)]'-c
V is 2x2
symmetric matrix, c
is a positive constant and there are two unknowns, x1
and x2
.
If I solve the equation using fsolve, I notice that the solution is very sensitive to the initial values
fsolve(fun, [1 1])
Is it possible to get the solution to this equation without providing an exact starting value, but rather a range? For example, I would like to see the possible combinations for x1, x2 \in (-4,4)
Using ezplot
I obtain the desired graphical output, but not the solution of the equation.
fh= @(x1,x2) [x1 x2]*V*[x1 x2]'-c;
ezplot(fh)
axis equal
Is there a way to have both? Thanks a lot!
you can take the
XData
andYData
fromezplot
:or you can use vector input to
fsolve
:However, the easiest and most straight forward approach is to rearrange the ellipse matrix form in a quadratic equation form: