## Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1494
Number of posts: 2174

This Forum Only

monte carlo integration Posted by hh278 on 14 Feb 2011 at 6:39 PM
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
Re: monte carlo integration Posted by rg123 on 30 Aug 2012 at 8:59 AM
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
Re: monte carlo integration Posted by rg123 on 30 Aug 2012 at 9:03 AM
Apologize for reposts, kept getting errors when posting.
Re: monte carlo integration Posted by rg123 on 30 Aug 2012 at 9:08 AM
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:

Monte Carlo Simulation

using this basic information should help you with your problem
Re: monte carlo integration Posted by rg123 on 30 Aug 2012 at 9:12 AM
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:

Monte Carlo Simulation

using this basic information should help you with your problem
Re: monte carlo integration Posted by rg123 on 30 Aug 2012 at 9:15 AM
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:

Monte Carlo Simulation

using this basic information should help you with your problem

## Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic