Write a user-defined function that plots an ellipse with axes that are parallel
ID: 3121837 • Letter: W
Question
Write a user-defined function that plots an ellipse with axes that are parallel to the x and y axes, given the coordinates of two vertices and another point that the ellipse passes through. For function name and arguments, use ellipseplot(A, B, C). Here A and B are 2-element vectors containing vertex coordiates and C is a 2-element vector containing coordinates of the other point on the ellipse. Use the function to plot the ellipses containing these points. (a) A (2, 3), B (11, 3), C(10, 4) (b) A (2, 11), B(2, -4), C(4, 8)Explanation / Answer
Solution: (a)
The general equation of ellipse in 2D can be written as
………………………(1)
By using given three points here we will find out the coefficients of
Now we will form a matrix by using the three points and given by
…………………….(2)
In our given problem the three points and are given by respectively.
Therefore using equation (2) we have
…………………….(3)
Now we solve system of equations (3) by matrix inversion method.
Therefore
and
Now the angle of inclind of the ellipse by
Now we know that
and
Therefore semi major axis
And semi minor axis
Therefore the equation of the ellipse is
If we put the values of and then we will get the required equation of the ellipse.
Solution: (b)
Same as solution (a)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.