Draw randomly centered circles of various sizes

バージョン 2.3.0 (371 KB) 作成者: Adam Danz
Set the range of radii, density, and other parameters to create a plot that draws randomly centered polygons with or without overlap.
ダウンロード: 721
更新 2021/1/22

ライセンスの表示

編集メモ: This file was selected as MATLAB Central Pick of the Week

bubblebath() plots circles or other polygons at random positions with varying radii. All input parameters are optional including frame size, range of radii, number of vertices per bubble (eg, polygon shape), density, the amount of space between bubbles or how much they can overlap, edge behavior, and other parameters. A figure is produced and there are four outputs that allow the user to make further changes to the plotted objects or to recreate the exact same plot using the same version of the code.

See the help section for a detailed description of each optional parameter and its default value.

bubblebath_examples.mlx contains many examples showing how to manipulate parameters and how to use the outputs to add color, calculated area of each circle, and other useful information.

Follow this page for updates.

引用

Adam Danz (2020). Bubblebath.m (https://www.mathworks.com/matlabcentral/fileexchange/70348), MATLAB Central File Exchange. Retrieved April 7, 2020.

MATLAB リリースの互換性
作成: R2020b
R2016a 以降のリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersPolar Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
2.3.0

Added option to wrap edges (edgeType=3); rearrangements and improvements in efficiency will affect reproducibility of plots between versions using the same rng seed.

2.2.0

S.circPoints added to control shape of polygon. Unrecognized input fields will throw warning instead of error. EdgeType=1 now fits more bubbles. Removed backtrace from max iteration warning. maxCircsPerRadius replaced with maxCircsPerRad.

2.1.0

S.nSizes was misrepresented in the outputs when its input value was NaN. Updated waitbar message to include number of circles being processed.

2.0.0

Converted to proper function with optional inputs; added several new options to supress internal warnings, control overlap, avoid memory problems, and more. Updated documentation and input validation.

1.2.0

Updated to work with matlab releases prior to r2016b in response to Guang Lu's comment. Also added a waitbar to show progress.

1.0.0