Borrar filtros
Borrar filtros

Function to be used for calculating number of points(randomly generated) inside the rectangular area

2 visualizaciones (últimos 30 días)
Number of points inside the rectangular area for randomly generated numbers...

Respuestas (1)

David Hill
David Hill el 8 de Mzo. de 2022
Editada: David Hill el 8 de Mzo. de 2022
I assume something like this: (other dimension does not matter)
r=1000*rand(1,100000);%generate 100000 rand numbers between 0 and 1000
p=[563,565.7,616.5,619.2,670,672.7];
for k=1:length(p)
n(k)=nnz(r>p(k)&r<=p(k)+.8);%provides the number of points in each rectangle
end

Categorías

Más información sobre Monte-Carlo en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by