lundi 14 mai 2018

expected value of random uniformly variable in matlab

I actually don't really know if this post belongs to this community but I think it is about failure in my code rather than my calculations.(If it doesn't belong here I will move this post to another community)

I got assignment in my Probability course to demonstrate the expected value enter image description here of the following random variable enter image description here.

I need to write a code in matlab that getting N random real between [0,1] and calculating the following value enter image description here for each enter image description here and show why the sequence of values converges to the the value enter image description here

I wrote the following code in matlab:

enter image description here

but the value of E(i) converges to 0.46 instead of the real expected value.

What have I done wrong in my code?

Thank you, Michael




Aucun commentaire:

Enregistrer un commentaire