How do I integrate a definite integral using the metropolis algorithm?

조회 수: 2 (최근 30일)
Gaëtan Poirier
Gaëtan Poirier 2017년 10월 25일
I don't quite understand how I would go about this? I understand that I have a random walk that samples the function, given by:
Fun = @x. ...;
x = 0;
delta =...;
for
r=rand();
x_T=x+delta(2r-1);
P=f(x_T)/f(x)
if P>=1;
then x = x_T;
else
if P>= r
then x = x_T;
else
x=x;
end
end
To find the integral using this method, I understand I have to sample a PDF? What is the PDF/how do I find it? Moreover, how to I talk the sampling after the random walk and use it to approximate the integral of the function.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Condensed Matter & Materials Physics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by