Question: The following equations represent two ellipses: ( x - 2 ) 2 + ( y - 3 + 2 x ) 2 = 5 2

The following equations represent two ellipses:
(x-2)2+(y-3+2x)2=5
2(x-3)2+(y3)2=4.
Write a MATLAB script 'ellipsesTask.m' to
Task 1: plot the two ellipses in one figure using Matlab function plot and;
Task 2: find the coordinates of all the intersections (there are 4 of them) of the two ellipses defined in
Eqs. (1) and (2).
Key Requirements:
The solution should be contained in one MATLAB script named as 'ellipsesTask.m'
Task 1
plot the two ellipses in one figure using MATLAB function plot only
The plot should be clear and contains correct labelling
Task 2
Convert the intersection-finding problems into root-finding problems in the form of f(x)=0
where all four f(x) need to be explicitly defined in the MATLAB code
Implement Newton's method and use it to find and print the coordinates (x,y) of all the inter-
sections of the two ellipses. Note: you can use any online derivative finder to find f'(x)
The Newton's method implemented should stop based on a given error margin, e.g.=0.001
your MATLAB script shouldn't use any symbolic functions such as sym, syms.
Submission:
A Matlab script.
% Task 1: Plot the two ellipses in one figure using Matlab function plot
figure;
% Define the range for x and y
x_range =-10:0.1:10;
y_range =-10:0.1:10;
% Initialize matrices to store the points satisfying each ellipse equation
ellipse1_points =[];
ellipse2_points =[];
% Loop through the points and check if they satisfy the ellipse equations
for x = x_range
for y = y_range
if abs((x-2)^2+(y-3+2*x)^2-5)0.1
ellipse1_points =[ellipse1_points; x, y];
end
if abs(2*(x-3)^2+(y/3)^2-4)0.1
ellipse2_points =[ellipse2_points; x, y];
end
end
end
% Plot the ellipses
plot(ellipse1_points(:,1), ellipse1_points(:,2),'b-', 'LineWidth', 2);
hold on;
plot(ellipse2_points(:,1), ellipse2_points(:,2),'r-', 'LineWidth', 2);
% Add labels and title
xlabel('x');
ylabel('y');
legend('Ellipse 1', 'Ellipse 2');
title('Two Ellipses');
grid on;
hold off;
% Task 2: Find the coordinates of all the intersections (there are 4 of them) of the two ellipses defined in Eqs. (1) and (2)
syms x y;
% Define the ellipse equations
ellipse1=(x -2)^2+(y -3+2*x)^2==5;
ellipse2=2*(x -3)^2+(y/3)^2==4;
% Find the intersection points
[x_intersect, y_intersect]= solve(ellipse1, ellipse2, x, y);
% Convert the symbolic solutions to numeric values
x_intersect = double(x_intersect);
y_intersect = double(y_intersect);
% Display the intersection points
fprintf('The intersection points are:
');
for i =1:length(x_intersect)
fprintf('(%.4f,%.4f)
', x_intersect(i), y_intersect(i));
end
(This code is giving me scattered ellipses. I want continous ellipses please. )
 The following equations represent two ellipses: (x-2)2+(y-3+2x)2=5 2(x-3)2+(y3)2=4. Write a MATLAB

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!