matrix addition and substraction
Mostrar comentarios más antiguos
{a1; a2; 0}
i want to R1-R1 and R2+R1
4 comentarios
Chaudhary P Patel
el 31 de En. de 2022
What are R1 and R2? Why can't you just add them as you wrote?
Why would it matter whether they happen simultaneously or sequentially?
What are the results assigned to? Are they being assigned to each other?
What does {a1; a2; 0} have to do with this?
Chaudhary P Patel
el 31 de En. de 2022
Chaudhary P Patel
el 31 de En. de 2022
Respuestas (1)
@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 comentarios
Chaudhary P Patel
el 31 de En. de 2022
KSSV
el 31 de En. de 2022
% random matrix for demo
a1 = rand(15,1) ;
a2 = rand(15,1) ;
id1 = 1:length(a1)-1 ;
id2 = 2:length(a1) ;
a = a1(id1)+a1(id2) ;
b = a1(id1)-a1(id2) ;
Chaudhary P Patel
el 31 de En. de 2022
Editada: KSSV
el 31 de En. de 2022
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
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!