save and use the same state...use somethin like this as mentioned in help for the rand function
% initialize somewhere in begining and there after use the following two lines
s = rand('twister');
rand('twister',s);
R = rand(1,2);
"yang " <macmaster_egypt@yahoogroups.com> wrote in message <h2ia85$aq3$1@fred.mathworks.com>...
> Hi everyone,
> I tried to use Matlab to calculate the following
> ____________________________________
> m=2;
> > R=rand(1,2);
> > unit=[1.0;1.0];
> > a=[0.0,0.0];
> > for I = 1: m
> > sm(I)=0.0;
> > for L= mI+1: m
> > sm(I)=sm(I)+a(L);
> > end
> > S=1.0/(I+sm(I));
> > G(I)=[R(I)].^S;
> > end
> > PROD=1.0;
> > for k = 1:m
> > PROD=PROD * G(m+1k);
> > x(k)=1.0PROD;
> > U(k)=log(x(k)/(1x(k)));
> > end
> > _______________________________________
> The problem is that random numbers R changes for each run I want it not to be changed.
>
> Thank you very much
>
> hassan010012@yahoo.com
>
>
> > what is the value of m?
