Re: using random with constraints
- From: "Anna Chen" <icedredtea@xxxxxxxxx>
- Date: Wed, 13 Aug 2008 16:42:01 +0000 (UTC)
thanks for your help!
"Lorenzo Guerrasio" <lorenzo.guerrasio@xxxxxxxx> wrote in
message <g7utam$afn$1@xxxxxxxxxxxxxxxxxx>...
"Lorenzo Guerrasio" <lorenzo.guerrasio@xxxxxxxx> wrote inand
message <g7usia$2n$1@xxxxxxxxxxxxxxxxxx>...
"Anna Chen" <icedredtea@xxxxxxxxx> wrote in message<g7uqs2
$8eq$1@xxxxxxxxxxxxxxxxxx>...
hello,
i would like to generate random vectors that have the
constraint that the components should sum to zero,
Therethatwould
the components are picked from some distribution.
there be an easy way to do this using "random"?
thanks!
Hi, the only distribution I know is the Von Mises.
isvectors
a nice file the the exchange (randraw) to produce
from a von mises distribution.last
Once you get these vectors, you can multiply them for a
random variable, to change the amplitude, and add the
opposite distribution.
Alternatively you can extract the hor and ver component
from a gaussian distribution with 0 mean and adding a
component so that sum([hor_comp,ver_comp])==0.
Maybe there are more elegant way...
bye
just to give an example...
hor_comp = normrnd(0,10,1000,1);
ver_comp = normrnd(0,10,1000,1);
hor_comp = [hor_comp;-sum(hor_comp)];
ver_comp = [ver_comp;-sum(ver_comp)];
.
- References:
- using random with constraints
- From: Anna Chen
- Re: using random with constraints
- From: Lorenzo Guerrasio
- Re: using random with constraints
- From: Lorenzo Guerrasio
- using random with constraints
- Prev by Date: Creating and reading .fis files
- Next by Date: Re: Efficient File Write (better than csvwrite?)
- Previous by thread: Re: using random with constraints
- Next by thread: Re: using random with constraints
- Index(es):
Relevant Pages
|
Loading