필터 지우기
필터 지우기

question about the sign

조회 수: 2 (최근 30일)
Dija
Dija 2014년 12월 4일
댓글: Dija 2014년 12월 4일
i have this matrix
H =
1 1 1 1 1 1 1 1
1 -1 1 -1 1 -1 1 -1
1 1 -1 -1 1 1 -1 -1
1 -1 -1 1 1 -1 -1 1
1 1 1 1 -1 -1 -1 -1
1 -1 1 -1 -1 1 -1 1
1 1 -1 -1 -1 -1 1 1
1 -1 -1 1 -1 1 1 -1
i did this code H(se+1,:)=2 H(s0+1,:)=5 to put 2 in some rows and 5 in the rest i get this
H =
2 2 2 2 2 2 2 2
5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5
2 2 2 2 2 2 2 2
5 5 5 5 5 5 5 5
2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2
5 5 5 5 5 5 5 5
it is correct but the problem that i want to keep the sign of H
i have to get this H =
2 2 2 2 2 2 2 2
5 -5 5 -5 5 -5 5 -5
5 5 -5 -5 5 5 -5 -5
2 -2 -2 2 2 -2 -2 2
5 5 5 5 -5 -5 -5 -5
2 -2 2 -2 -2 2 -2 2
2 2 -2 -2 -2 -2 2 2
5 -5 -5 5 -5 5 5 -5
help me, Thanks :)

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 12월 4일
편집: Azzi Abdelmalek 2014년 12월 4일
Use sign function
In your case you can use
H(se+1,:)=2*H(se+1,:)
  댓글 수: 1
Dija
Dija 2014년 12월 4일
Thank you

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by