how to create matrix?

2 visualizaciones (últimos 30 días)
ankanna
ankanna el 18 de Abr. de 2021
Comentada: ankanna el 24 de Abr. de 2021
node = 3;
i want this matrix logically
0 1 1
1 0 1
1 1 0
please help to generate this

Respuesta aceptada

DGM
DGM el 18 de Abr. de 2021
Editada: DGM el 18 de Abr. de 2021
Something like this?
node=3;
mymat=1-eye(node);
  4 comentarios
ankanna
ankanna el 18 de Abr. de 2021
i know that algarithm will be wrong. but i can try to solve any other ways
ankanna
ankanna el 18 de Abr. de 2021
node = 3;
NN = toeplitz(node+1:-1:2);
mask = logical(fliplr(diag(ones(1,node-1),-1)));
NN(mask) = 1;
please explain detail using this terms. i dont understand to this code. please explain any simple way to understand this code

Iniciar sesión para comentar.

Más respuestas (1)

Robert Brown
Robert Brown el 18 de Abr. de 2021
you can specify the elements of a 3x3 matrix as follows:
>> a = [1 2 3; 4 5 6; 7 8 9]
the result will be
a =
1 2 3
4 5 6
7 8 9
with the correct order of 1's and 0's, you should be able to build the arrays you wish to have...
I hope this helps :-)
  1 comentario
ankanna
ankanna el 24 de Abr. de 2021
n = 3;
Link=(n*(n-1))/2;
c=2^Link;
NN = toeplitz(Link+1:-1:2)
mask = logical(fliplr(diag(ones(1,Link-1),-1)));
NN(mask) = 1;
for c = 0:2^Link-1
l = bitget(c, NN)
end
the above code i generate all configuration matrix.
i need to generate all paths in this network.
please help me to generate all paths in the network

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by