I have to write a MATLAB function that estimates the value pi based on the fraction of a collection of random points in the square [1; 1] that are within the circle of radius 1 centered at the origin.(adsbygoogle = window.adsbygoogle || []).push({});

I am very new to MATLAB and computer science in general and I've been having a great deal of difficulty figuring things out. I know that I need to create a function that generates a large number of random points on a plot where both the x and y axis are from -1 to 1. With those points I know that I need to make it so that the points within the unit circle with a center at 0,0 are distinguishable from the other remaining points, and finally I need to find out the value of pi using those points within the circle. I've been trying to figure out how to at least make a plot with more than 1 random point but I can't even do that. Can someone help me understand how to make MATLAB generate multiple random points within the parameters mentioned above? And after I've figured out how to do that maybe I can understand how to approximate the value of pi from all of this.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB function that estimates pi

**Physics Forums | Science Articles, Homework Help, Discussion**