Question: The following equations represent two ellipses: ( x - 2 ) 2 + ( y - 3 + 2 x ) 2 = 5 2
The following equations represent two ellipses:
Write a MATLAB script 'ellipsesTask.m to
Task : plot the two ellipses in one figure using Matlab function plot and;
Task : find the coordinates of all the intersections there are of them of the two ellipses defined in
Eqs. and
Key Requirements:
The solution should be contained in one MATLAB script named as 'ellipsesTask.m
Task
plot the two ellipses in one figure using MATLAB function plot only
The plot should be clear and contains correct labelling
Task
Convert the intersectionfinding problems into rootfinding problems in the form of
where all four need to be explicitly defined in the MATLAB code
Implement Newton's method and use it to find and print the coordinates of all the inter
sections of the two ellipses. Note: you can use any online derivative finder to find
The Newton's method implemented should stop based on a given error margin, eg
your MATLAB script shouldn't use any symbolic functions such as sym syms
Submission:
A Matlab script.
Task : Plot the two ellipses in one figure using Matlab function plot
figure;
Define the range for x and y
xrange ::;
yrange ::;
Initialize matrices to store the points satisfying each ellipse equation
ellipsepoints ;
ellipsepoints ;
Loop through the points and check if they satisfy the ellipse equations
for x xrange
for y yrange
if absxyx
ellipsepoints ellipsepoints; x y;
end
if absxy
ellipsepoints ellipsepoints; x y;
end
end
end
Plot the ellipses
plotellipsepoints: ellipsepoints:b 'LineWidth', ;
hold on;
plotellipsepoints: ellipsepoints:r 'LineWidth', ;
Add labels and title
xlabelx;
ylabely;
legendEllipse 'Ellipse ;
titleTwo Ellipses';
grid on;
hold off;
Task : Find the coordinates of all the intersections there are of them of the two ellipses defined in Eqs. and
syms x y;
Define the ellipse equations
ellipsex y x;
ellipsex y;
Find the intersection points
xintersect, yintersect solveellipse ellipse x y;
Convert the symbolic solutions to numeric values
xintersect doublexintersect;
yintersect doubleyintersect;
Display the intersection points
fprintfThe intersection points are:
;
for i :lengthxintersect
fprintfff
xintersecti yintersecti;
end
This code is giving me scattered ellipses. I want continous ellipses please.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
