I am trying to generate a matrix with some error but it should be different every trail.But in my case,I am getting exactly same matrix with error on each trail.My code is below-
N=50;
R=50;
TrialNum=100;
Error,Pe=0.05;
A(1:N,1:N) = eye(N);
seed=6;
rng(seed,'twister');
B = round((rand(R,N)));
C=[A;B];
for t=1 : TrialNum
Rp = C ;
for i=1:(N+R)
if(rand < Pe)
Rp(i,:) = 0;
end
end
end
From this code, every time I will get A as diagonal matrix and B will generate matrix using random number with seed. C is total 100x50 matrix.This matrix will goes to next loop and every trail different number of packet will be lost due to Pe.
C matrix will be same all the trail but Rp matrix will be different for every trial but I am getting exactly same Rp matrix on every trail.
For example-
trial=1, N=3, R=2
Rp=1 0 0
0 1 0
0 0 0
1 0 1
0 1 1
trial=2, N=3, R=2
Rp=1 0 0
0 0 0
0 0 1
1 0 1
0 0 0
Need some experts comment.Any help will be appreciated.