Clear Filters
Clear Filters

question about the sign

2 views (last 30 days)
Dija
Dija on 4 Dec 2014
Commented: Dija on 4 Dec 2014
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 :)

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 4 Dec 2014
Edited: Azzi Abdelmalek on 4 Dec 2014
Use sign function
In your case you can use
H(se+1,:)=2*H(se+1,:)

More Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!