Calculate distance between the circumference of two ellipse

4 views (last 30 days)
I have the following code
This makes two ellipses: the first one by interpolation of 100 points, and the second one by a parametric equation. I want to calculate the maximum and minimum difference between both the circumferences. Attached image will make it clear what I want. Any help will be deeply appreciated. Thank you
s=pi/180;
i=1:100;
t=3.6*s*i;
x=30*cos(t);
y=15*sin(t);
c=linspace(0,2*pi);
a=30*cos(c);
b=15*sin(c);
plot(x,y,a,b)
  4 Comments
Image Analyst
Image Analyst on 25 Sep 2015
Your image still didn't come through. Try copying your image to the clipboard, and then using http://snag.gy and just pasting your image in to that web site, and then using the brown and green frame icon to paste in the URL it gives you and your image will appear in your post.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 25 Sep 2015
It's a little tricky since you can't just measure the distance of the kth point of ellipse 1 to the kth point of ellipse 2 because of the spacing parameter which might cause the kth point of ellipse 1 to lie between other points, like the (k+3)rd point and the (k+4)th point. So what I would do is for every point in ellipse 1, calculate the distance to every point in ellipse 2 (this is one line of code in a for loop). Then for all those distances, select the two closest. Hint: use both return arguments of sort(). That will tell you which two points of ellipse 2 it's between. Then for the distances to those two points, take the maximum. Since it sounds really a lot like homework, I'll leave the coding up to you.
  21 Comments
Image Analyst
Image Analyst on 28 Sep 2015
You do not have that situation. None (except the first) of your points are at the same angle.
If you want, you could use polyarea() for the two and compare the results to the theoretical area = pi*a*b where a and b are the major and minor semi-axes.

Sign in to comment.

More Answers (0)

Categories

Find more on 3-D Scene Control 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!