hs923a function for Monte Carlo Approx

3 visualizzazioni (ultimi 30 giorni)
gracias claude
gracias claude il 11 Apr 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

Risposte (1)

Andreas Apostolatos
Andreas Apostolatos il 11 Apr 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

Categorie

Scopri di più su Sparse Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by