File Exchange Pick of the Week

Our best user submissions

Draw a bubble bath

Jiro‘s Pick this week is bubblebath by Adam Danz.

Adam is no stranger to File Exchange and File Exchange Pick of the Week. He is even more active on MATLAB Answers. In fact, this entry by Adam stemmed from a question on MATLAB Answers. The original poster asked for ways of creating non-overlapping randomly placed circles within a region, with an ability to specify some parameters such as number of circles and min/max radii.

Let’s look at an example. Here, we will create circles with 10 linearly spaced different radii ranging from 1 to 10.

S.circSize = [1 10];
S.nSizes = 10;
S.supressWarning = true;

Next, we specify the exact set of radii for the circles.

S.circSize = [0.5 1 1.5 3 5 20];
S.nSizes = NaN;

I appreciate the effort he took to create this entry after some discussions on MATLAB Answers. He has also updated his entry based on the comments.

The other thing I really like is the detailed documentation (help) he includes with the function and the thorough error-checking for the input arguments. Those of you who have read some of my recent posts (this and this) know that I am a big fan of the new Function Argument Validation that was introduced in R2019b. I understand that Adam wrote his function in an older release, but once he upgrades to the newest release, I encourage him to give it a try!

Lastly, I’d like to give a shout-out to a few other entries that were mentioned in the MATLAB Answers post.


Give it a try and let us know what you think here or leave a comment for Adam.

Published with MATLAB® R2019b

  • print
  • send email


댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.