In last week's Pick of the Week, I talked about fitting a circle to a collection of points. With a small example, I showed how Izhak
Bucher's CircFit makes short work of that task. But to visualize the circle I fit through my faked data, I used MATLAB's rectangle command!
If that seems odd to you, then this week's pick is for you: Zhenhai Wang's Draw a Circle submission lets you visualize your circle with (to me) a much more natural syntax, specifying the coordinates of the center,
the radius of the circle, and the number of points to plot. Optionally, the file also lets you specify the style parameters
for the plotted curve.

Okay, so you may be thinking that plotting a circle with this syntax isn't the most difficult thing you've ever tried to do.
Still, nearly 24,000 people have downloaded Zhenhai's file! This suggests that it might not be trivially easy, either. Or
at least, that it's awfully convenient to be just be the beneficiary of someone else's work. And "Draw a Circle" is pretty
well vetted, too; it has an average of 4.29 (out of 5) stars, from 42 reviews. That means a lot of people are happy with Zhenhai's
effort. In fact, years after its submission, "Draw a Circle" continues to get hundreds of downloads every month (661 in the
past 30 days). Moreover, two other files cite this week's selection as an inspiration. Nice work, Zhenhai!

Got a favorite plotting routine that makes your life easier? Let us know about it!

Sometimes we may focus on a submission because it is beautifully written…other times, simply because it does something useful, and does it well. Zhenhai’s “Circle” certainly fits that latter bill.

Urs, why would you necessarily think that HOLD-ing should be incorporated in the CIRCLE command? Many useful functions use PLOT commands–and in all cases it is up to the user to issue (or not, –depending on his or her desired behavior) the HOLD command.

Terry, I’m not sure there’s anything inherently easier about using complex coordinates than the very compact pol2cart that this function uses.

Sunpeng, I haven’t really played with your code, and it certainly appears that you’ve added some nice functionality. But I will note that your file requires the Image Processing Toolbox. I could argue that generic functionality like plotting a circle should be independent of that (or any) Toolbox.

@Maarten,
Yep, _rectangle_ will do it. (You might want to re-read the first few sentences of my post above.) Sometimes, though, it is nice to be able to position circles parametrically, or with different syntax–one that gives you pointwise control over the plot, for instance.

LFR is the name of local featuers regoin on this paper A Feature based robust digital image watermarking against geometric attacks by Xiang-yang Wang
“Based on scale space theory and an image normalization technique, a new feature-based image watermarking scheme robust to general
geometric attacks is proposed in this paper. First, the Harris–Laplace detector is utilized to extract steady feature points from the
host image; then, the local feature regions (LFR) are ascertained adaptively according to the characteristic scale theory, and they are
normalized by an image normalization technique; finally, according to the predistortion compensation theory, several copies of the digital
watermark are embedded into the nonoverlapped normalized LFR by comparing the DFT mid-frequency magnitudes.

These postings are the author's and don't necessarily represent the opinions of MathWorks.