Le 10/06/2016 à 15:59, Jens Simon Strom a écrit :
rand(n,1)–rand(n,1) is definitely  NOT uniform.
by convolution the density of such a variable  seems triangle shaped :

f(x)=1/2-abs(x)/4, if x \in [-2,2]
     =0, elsewhere


S.


Jens
------------------------------------------------------------------------------
Am 10.06.2016 15:33, schrieb Samuel Gougeon:
Le 10/06/2016 15:21, Carrico, Paul a écrit :

Hi

In order to simulate dimensional tolerances in +/-, I’m using the following workaround :

n = 100;

a = rand(n,1) – rand(n,1);

Of course I need to increase the N value to the domain … is there a more “clever” way ?

grand(n,1,"unf",-1,1)

BTW, i am not sure that rand(n,1)–rand(n,1) builds (or keeps) a uniform distribution over [-1, 1].

Samuel



_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users


--
Département de Génie Informatique
EA 4297 Transformations Intégrées de la Matière Renouvelable
Université de Technologie de Compiègne -  CS 60319
60203 Compiègne cedex

_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to