|
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <htk7ua$a64$1@fred.mathworks.com>...
> "Artur Artur" <arturracu@yahoo.com> wrote in message <htk4g4$rel$1@fred.mathworks.com>...
> > "Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <htjg6u$14o$1@fred.mathworks.com>...
> > > "Artur Racu" <arturracu@yahoo.com> wrote in message <htjeqd$s1a$1@fred.mathworks.com>...
> > > > hy all,
> > > >
> > > > could anyone help me on this problem...i have 100 different random values which i want to inject in a system during 15 seconds, the simple way i can do is to inject each value with the step 0.15s, but the ideea is that i want to inject them dynamicaly, so for this i need small randoms times, so thats why i want random values with sum 15 ) could anyone help me on this?
> > > >
> > > > Thank you,
> > > >
> > > > Artur
> > >
> > > %Random 100 long vector
> > > rvec = rand(1,100);
> > >
> > > %time to wait between insertion
> > > tvec = (rvec/sum(rvec))*15; %find percentages then multiply by total time
> > >
> > > %Time relative to start
> > > trel = cumsum(tvec);
> >
> > thanks a lot Sean it really help
>
> The trouble with that kind of solution is that it packs points more densely in towards the center of the available space. To see this try the following:
>
> n = 8000;
> p = rand(3,n);
> p = p./repmat(sum(p,1),3,1)*15; % Now each column of p has the sum 15
> plot(p(1,:),p(2,:),p(3,:),'y.')
>
> As you can see, the points are bunched more densely towards the center of the triangle.
>
> In the Wikipedia site below there is a section on "random sampling" or "simplex point picking" which shows two methods of providing a uniform packing of points within your simplex - that is, within the space of points whose sum is the desired 15 in your case.
>
> http://en.wikipedia.org/wiki/Simplex
>
> Roger Stafford
dear Roger,
i'm sorry if i wasn' clear, this is not i want...so...i have 100 random values which i want to inject in a power system so i can disturb it, the time for this incident is 15 seconds, the way i am doing now is this:
0.15s-first rand value
0.3s-second rand value
0.45s-third rand value
..........................
14.45s-99-th rand value
15s-100 rand value
so, if i am doing in this way i will have a liniar time disturbance that's way i want 100 random values for this 15s
thank you
Artur
|