matrix addition and substraction

2 visualizaciones (últimos 30 días)
Chaudhary P Patel el 31 de En. de 2022
Comentada: Chaudhary P Patel el 31 de En. de 2022
{a1; a2; 0}
i want to R1-R1 and R2+R1
4 comentariosMostrar 2 comentarios más antiguosOcultar 2 comentarios más antiguos
Chaudhary P Patel el 31 de En. de 2022
R1 and R2 are row 1 and row 2.
Chaudhary P Patel el 31 de En. de 2022
Actually it is a 15X1 matrix of {a1;a2;0;a1;a2;0.....................;a1;a2;0}
so i want to do a1-a1 and a2+a1 for each set

Iniciar sesión para comentar.

Respuestas (1)

KSSV el 31 de En. de 2022
Editada: KSSV el 31 de En. de 2022
@pramod kumar What ou ask is a very basic question. I would suggest you to take a basic introductory course in MATLAB.
Your question is simple.
% random matrix for demo
a1 = rand(15,1) ;
a2 = rand(15,1) ;
% add
a = a1+a2 ;
% subtract
b = a1-a2 ;
5 comentariosMostrar 3 comentarios más antiguosOcultar 3 comentarios más antiguos
KSSV el 31 de En. de 2022
This will throow error. It will not yun, as a is a scalar and you are trying to access it a svector.
Chaudhary P Patel el 31 de En. de 2022
sir,
7.9710
7.9710
0
7.9710
7.9710
0
7.9710
7.9710
0
7.9710
7.9710
0
7.9710
7.9710
0
this is my column matrix and i have to 1,4,7,10,13 as zero by and 2, 5,8,11,14 row be Row2+row1, row5+row4, row8+row7, row11+row10, row14+row13.

Iniciar sesión para comentar.

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by