Does Matlab have a library for Monte Carlo integration

조회 수: 1 (최근 30일)
Radoslav Vuchkov
Radoslav Vuchkov 2021년 6월 29일
댓글: Radoslav Vuchkov 2021년 6월 29일
Hello,
I have been doing some reading and I cannot seem to find a simple to use matlab library to do Monte Carlo integration in n dimentions. For my needs I want to integrate a function over a n dimentional square.
Thank you very much for the inputs and ideas.

답변 (1개)

John D'Errico
John D'Errico 2021년 6월 29일
편집: John D'Errico 2021년 6월 29일
Do they have a "library"? Not really what I would call a "library". Maybe you might. But why would they? They offer random number generation functions, which is all you need. In this case, all you need is the function RAND. RAND can generate sets of points that lie uniformly inside an n-dimensional square.
  댓글 수: 1
Radoslav Vuchkov
Radoslav Vuchkov 2021년 6월 29일
I understand what you are saying in fact I wrote the code below to do an integration over a square. However this converges really slowy and I was hoping for something a bit more safisticated if that makes sense. For example in python there is the qmcpy library where they use a bit more machinery for better/faster convergence.
sampleN = 10000000;
w = a + (b - a)*rand(d,sampleN);
MC = (1/sampleN)*sum(fun(w));

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by