node = 3;
i want this matrix logically
0 1 1
1 0 1
1 1 0
please help to generate this

 채택된 답변

DGM
DGM 2021년 4월 18일
편집: DGM 2021년 4월 18일

0 개 추천

Something like this?
node=3;
mymat=1-eye(node);

댓글 수: 4

ankanna
ankanna 2021년 4월 18일
I also want this
0 0 0
0 0 0
0 0 0
0 0 0
0 0 1
0 1 0
0 0 1
0 0 0
1 0 0
0 0 1
0 0 1
1 1 0
0 1 0
1 0 0
0 0 0
0 1 0
1 0 1
0 1 0
0 1 1
1 0 0
1 0 0
0 1 1
1 0 1
1 1 0
please help me to generate loop wise matrix
Walter Roberson
Walter Roberson 2021년 4월 18일
Using a different implementation of generating these matrices will not solve the problem that you are trying to implement an algorithm from a paper that is incorrect and that the paper needs to be fixed.
ankanna
ankanna 2021년 4월 18일
i know that algarithm will be wrong. but i can try to solve any other ways
ankanna
ankanna 2021년 4월 18일
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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Robert Brown
Robert Brown 2021년 4월 18일

0 개 추천

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

ankanna
ankanna 2021년 4월 24일
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

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2016a

태그

질문:

2021년 4월 18일

댓글:

2021년 4월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by