Description: function pi = solve2 (count, m, cc) to vote with Buffon needle experiment simulation find the value of pi pi = 0 frq = 0 randNo = binornd (1, cc, 1, m) pro = zeros (1, count) for j = 1: count for i = 1: m if randNo (1, i) == 1 frq = frq+ 1 end pro (i) = frq/i end pi = (2* m )/frq pro (j) = pi end pro = pro, num = 1: count plot (num, pro)
To Search:
File list (Check if you may need any files):
liti5.m
solvePi.asv
liti2.m
solveP22i.m
solve2.m