hs923a function for Monte Carlo Approx

1 回表示 (過去 30 日間)
gracias claude
gracias claude 2021 年 4 月 11 日
回答済み: Andreas Apostolatos 2021 年 4 月 11 日
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

回答 (1 件)

Andreas Apostolatos
Andreas Apostolatos 2021 年 4 月 11 日
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

カテゴリ

Help Center および File ExchangeSparse Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by