필터 지우기
필터 지우기

Fitting N(N-1) points on an NxN matrix

조회 수: 2 (최근 30일)
Vic
Vic 2012년 12월 1일
Suppose I have an N(N-1) vector that corresponds to each non-diagonal entry of an NxN matrix. Is there anyway that I can encode that onto my matrix?
i.e. For n=3, given [ 2 3 4 5 6 7 ] we obtain
[0 4 6 ; 2 0 7 ; 3 5 0]?
  댓글 수: 2
Nasser M. Abbasi
Nasser M. Abbasi 2012년 12월 1일
편집: Nasser M. Abbasi 2012년 12월 1일
If one posts same question here and at another forum at the same time, like comp.soft-sys.matlab, it is only right that you mention that and give a link. This way one does not waste their time if someone else already answered you on the other forum.
Vic
Vic 2012년 12월 1일
I didn't know how that happened... but thanks for letting me know

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

채택된 답변

Matt Fig
Matt Fig 2012년 12월 1일
편집: Matt Fig 2012년 12월 1일
% Say your given vector is:
X = [ 2 3 4 5 6 7 ];
% Now to make the matrix.
L = (1 + sqrt(1+4*length(X)))/2;
F = double(~eye(L));
F(~eye(L)) = X

추가 답변 (1개)

Vic
Vic 2012년 12월 1일
thanks!

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by