Borrar filtros
Borrar filtros

Help with Monte Carlo sim?

2 visualizaciones (últimos 30 días)
Taylor Gates
Taylor Gates el 23 de Jul. de 2018
Respondida: Image Analyst el 23 de Jul. de 2018
Im messing around with the montecarlo function for integration and ran into a problem. The y bounds are between x^2 and x^3 and x are between 0 and 1. Heres the code I have so far but can't figure out how to deal with the y bounds.
N=1000; Landed=0;
for i=1:N x=rand()*1; y=rand()* Landed=Landed+1 end disp('Calculated Area Size:') area=

Respuesta aceptada

Image Analyst
Image Analyst el 23 de Jul. de 2018
That code won't even run. Even if it did, your x and y are just rand() which goes between 0 and 1. The y bounds have nothing at all to do with x, x^2 or x^3, but since they all use rand, everything will be between 0 and 1. If you want some higher value, multiply rand() by some amplification factor.
I'm attaching my Monte Carlo demos, for what it's worth.

Más respuestas (0)

Categorías

Más información sobre Monte-Carlo 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