Borrar filtros
Borrar filtros

question about the sign

2 visualizaciones (últimos 30 días)
Dija
Dija el 4 de Dic. de 2014
Comentada: Dija el 4 de Dic. de 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 :)

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 4 de Dic. de 2014
Editada: Azzi Abdelmalek el 4 de Dic. de 2014
Use sign function
In your case you can use
H(se+1,:)=2*H(se+1,:)

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by