Montecarlo method of pi calculation
バージョン 1.1.0.0 (1.5 KB) 作成者:
Konstantin Ninidze
Montecarlo method of pi calculation.
No loops!!!
A circle of radius 0.5 is inscribed inside a square with side length 1.
Script picks N points at random inside the square. It then checks to see if the point is inside the circle and then generates a figure in which the points ''in'' and ''out'' are plotted in different colors. Say we have M points inside the circle. Pi is then approximated as follows:
% Pi = 4*M/N.
No loops!!!
引用
Konstantin Ninidze (2024). Montecarlo method of pi calculation (https://www.mathworks.com/matlabcentral/fileexchange/30687-montecarlo-method-of-pi-calculation), MATLAB Central File Exchange. 取得済み .
MATLAB リリースの互換性
作成:
R2010b
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linuxカテゴリ
Help Center および MATLAB Answers で Fourier Analysis and Filtering についてさらに検索
タグ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!