Write a MatLab script to plot two ellipses using the plot function

조회 수: 4 (최근 30일)
Ali
Ali 2024년 3월 17일
편집: Matt J 2024년 3월 17일
There was a similar question to this but I need to use the plot function for my task.
Task 1. I have been given 2 equations and I need to plot them in one figure using the plot function, I was wondering if anybody could help
plot the two ellipses in one figure using MATLAB function plot only
The plot should be clear and contains correct labelling
(x − 2)^2 + (y − 3 + 2x)^2 = 5
2 (x − 3)^2 + (y/3)^2 = 4
Task 2. I also need to find the coordinates of any intersections (there should be four) between the 2 ellipses
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
your MATLAB script shouldn’t use any symbolic functions such as sym, syms.
  댓글 수: 2
Matt J
Matt J 2024년 3월 17일
편집: Matt J 2024년 3월 17일
I hope you realize you won't be able to delete your question once someone answers it. It will remain here for all time for anyone to browse, including your instructor.
Ali
Ali 2024년 3월 17일
Thanks for telling me. Really I'd want advice on how to plot a graph from an equation in general, I do want to answer it myself as much as I can.

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2024년 3월 17일
편집: Matt J 2024년 3월 17일
As an example, here is a way to plot an unrotated ellipse of known major/minor axis lengths a,b.
a=5; b=3; %major/minor axes
cx=10;cy=20;%center coordinates
t=linspace(0,360,1000);
plot(a/2*cosd(t) +cx , b/2*sind(t)+cy ); axis equal padded; xlabel x; ylabel y

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by