#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# monte carlo integration

Posts: 1Member
Define a function mc_integral(N, a, b) which implements Monte Carlo algorithm of approximating value of the integral (1) for a given number of sample points N and the integral limits a and b. This function should return a single double value.
Run your Monte Carlo simulation by calling the function mc_integral(N, a,b) with a = 0, b = 6 and different N. Use N = 100, N = 100; 000 and
N = 100,000,000. Measure the running times for every value of N.

equation (1)...
sqrt(-2sin(theta)-(10/3)sin(2theta/3))^2+(2cos(theta)-(10/3)cos(2theta/3))^2
limits for the integral are 0 to 6pi

n is the number of samples generated could be 1000 or 1000000 etc
depands on user input
· ·

## Comments

• Posts: 6Member
There is a link for calculating pi using monte carlo as well as pretty basic information on how to perform all types of monte carlo simulations in matlab at the following site:

http://www.mathworks.com/discovery/monte-carlo-simulation.html

using this basic information should help you with your problem
· ·
• Posts: 6Member
Apologize for reposts, kept getting errors when posting.
· ·
• Posts: 6Member
There is a link for calculating pi using monte carlo as well as pretty basic information on how to perform all types of monte carlo simulations in matlab at the following site:

[link=http://www.mathworks.com/discovery/monte-carlo-simulation.html]Monte Carlo Simulation[/link]

using this basic information should help you with your problem
· ·
• Posts: 6Member
There is a link for calculating pi using monte carlo as well as pretty basic information on how to perform all types of monte carlo simulations in matlab at the following site:

[link=http://www.mathworks.com/discovery/monte-carlo-simulation.html]Monte Carlo Simulation[/link]

using this basic information should help you with your problem
· ·
• Posts: 6Member
There is a link for calculating pi using monte carlo as well as pretty basic information on how to perform all types of monte carlo simulations in matlab at the following site:

[link=http://www.mathworks.com/discovery/monte-carlo-simulation.html]Monte Carlo Simulation[/link]

using this basic information should help you with your problem
· ·
Sign In or Register to comment.