Sigh. You DID make an effort. It is not even a terrible solution, though what you did will not work, since it will at best be a full circle, and even then, it will only be a polygonal solution. That is, a contour plot is just a piecwise linear approximation. Finally, you needed to force the contour plotter to plot ONLY a specific contour, not a complete contour plot.
The contour plot you have generated is that of a paraboloid of revolution. So not really a good choice, because it is still the full circle.
How would I solve this problem? I can probably think of a couple of solutions given some time, though it seems absolutely silly to not just use pollar coordinates, since that is the direct and obvious solution. But can I do it? I imagine so.
It is simple enough to plot the full circle.
xCenter_2 = 3/(2*sqrt(13));
yCenter_2 = -1/sqrt(13);
radius = 0.5;
fxy = @(x,y) (x - xCenter_2).^2 + (y - yCenter_2).^2 - radius.^2;
fimplicit(fxy)
axis equal
But then to get only a half circle will take more work. A hack like this should work.
fxy = @(x,y) (x - xCenter_2).^2 + (y - yCenter_2).^2 - radius.^2 + (y > -(2/3)*x)*1e16;
fimplicit(fxy)
axis equal
I imagine I could do better, but why?
Or, I might formulate the problem as a differential equation, then use an ODE solver like ODE23s to solve it. If we differentiate the circle equation, it reduces to
2*(x-a) + 2*(y - b)*y' = 0
Therefore we would have
y' = -(x - a)/(y - b)
Start the solver off at one end of the arc, with initial conditions set to move in the correct direction around the circle. A stiff solver will probably be necessary, due to the singularity at y == b.
Finally, I could probably create the curve as a spline. I'm sure I could find other ways to build it. But why in the name of god and little green apples is there a reason to do so?
Just use polar coordinates.
Best Answer