hs923a function for Monte Carlo Approx

2 visualizaciones (últimos 30 días)
gracias claude
gracias claude el 11 de Abr. de 2021
Respondida: Andreas Apostolatos el 11 de Abr. de 2021
I found this function online and getting an error when using halton. Has the function changed in Matlab if so what do I use now ?
function hs923a(n)
x=2*halton(2,n)-1;
y=2*halton(3,n)-1;
count=1;
for i=1:n
if x(i)>=-1
if y(i)<=1
if 13*(x(i)^2)+34*x(i)*y(i)+25*y(i)^2 <= 1
count=count+1;
end
end
end
end
disp(['Number of points inside the ellipse =', num2str(4*count)])
end

Respuestas (1)

Andreas Apostolatos
Andreas Apostolatos el 11 de Abr. de 2021
Hello,
Function 'halton' does not appear to be a built-in MATLAB function. However, there is below a link to a custom MATLAB function with the name 'halton' that can be used in conjuction with your program,
which is part of a Gitlab repository.
I hope this helps.
Kind Regards,
Andreas

Categorías

Más información sobre Mathematics and Optimization en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by