- #1
- 69
- 0
Homework Statement
I want to calculate the surface area, mapped with points. For starters, I've mapped the edge of a circle with 200 points, then created a few more circles, each with 200 points. The problem is I get different surface areas for the same size circles. The only difference between the circles is the location.
Homework Equations
The method for mapping the circle with points is:
for i = 1:N+1
X(i,1) = x0 +R *cos(2*pi/N*(i-1));
X(i,2) = y0 +R *sin(2*pi/N*(i-1));
end
where x0 and y0 are coordinates of the circle's center. R is the radius of the circle, N the number of points.
To get the surface of the circle, I've tried the equation S = 1/2 int[ (r×ds)], where r is the vector to the i-th point and ds vector to the i+1-ith point.
The Attempt at a Solution
This is the loop I wanted to do the work with:
for i = 1:N-1
d = X(i,1) *(X(i+1,2) - X(i,2)) - X(i,2) *(X(i+1,1) - X(i,1));
S = S + 0.5*d;
end
It's basically a vector product between vectors r and ds. X is a 200×2 array of coordinates of points, first row for x coordinates, second row for y coordinates. I get the value of vector ds by doing the difference between the i-th point and the next point.
I will be doing this with shapes other than circles but I need to have it working with circles first. I know this must be caused by some dumb mistake of mine so don't be afraid to tell me.