how to generate code?

1 view (last 30 days)
ankanna
ankanna on 7 Apr 2021
procedure to simulate link status algarithm.
for i = 1,2,...,n
for j = i+1,...,n
test - select random number from uniform distribution between (0,1)
if (test<=;λ∩ni = 1∩nj = 1) then Li,j = 1
else; Li,j = 0
Lj,i = Li,j
L - load Li,j and Lj,i into the matrix L
this is the actual procedure to generate link status
program:-
nodes = 3; m = 0.7;
for i = 1:nodes
for j = i+1:nodes
test = unifrnd(0,1);
if ni == 1
nj = 1:nodes;
if (test<=m/ni==1./nj==1)
l(i,j) = 1;
else
l(i,j) = 0;
end
l(j,i) = l(i,j);
end
L = [l(i,j);l(j,i)];
end
end
the above program have some error that is on undefined variable or function is obtained. please help to correct this function.

Answers (0)

Products


Release

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by