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;
bubblebath(S);

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

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

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.

Comments

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




Published with MATLAB® R2019b

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.