Plotting ellipses with parametric curves
Show older comments
Hi all!
I need to plot the following ellipses on the same plot:
Ellips 1: 

Ellipse 2: 

I have substituted the formula for the second ellipse by u and v:
u = 

v = 

Ellipse 2: 

I have used the following parametrisation:
For an ellipse with the general fomula 

the parametrization:
and 
and 
So, I have rearranged the equation of both ellipses to fit the general formula and then calculated a and b according the get the parametrization above. I was supposed to get the following plot:

Instead I have got this:

I have written the following code:
% First ellipse
t = linspace(0,2*pi,200);
a = sqrt(2);
b = sqrt(2/3);
x = a.*cos(t);
y = b.*sin(t);
plot(((1/2)*(x.^2)), ((3/2).*(y.^2)), '-k', 'LineWidth', 1.5)
axis equal
hold on
% Second ellipse
t = linspace(0,2*pi,200);
a = 2;
b = 1;
x = (-a/3).*(cos(t)+((-2*b/3).*sin(t)));
y = (((2*a/3).*cos(t))+((7*b/3).*sin(t)));
u = x-(2.*y);
v = (2.*x)+y;
plot(((1/4).*(u.^2)), ((v.^2)), '-k', 'LineWidth', 1.5)
axis equal
hold off
What is it that I'm doing wrong? I am very thankful for all the help in advance!
Accepted Answer
More Answers (0)
Categories
Find more on Exploration and Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!