function y = CalkaMonteCarlo(f,a,b,n) x=0; for i=1:n temp = a + (b-a)*rand; x = x + f(temp); end y = (b-a) / n * x; end