How to add matrices with different dimensions
Mostrar comentarios más antiguos
hello, I want the shortest way to add matrices with different dimensions. I know the easiest way but it is not appropriate for big matrices like 10*10 or bigger please see the picture to understand what I mean Sorry there was a problem with the picture. I provide an example. I hope it is clear now.

6 comentarios
Azzi Abdelmalek
el 4 de Abr. de 2014
How? post a short numeric example with the expected result
Joseph Cheng
el 4 de Abr. de 2014
wha? Am i missing something? K1 looks to be 4x4 that has a mosaic of k sub nxm following row column numbering. K2 is a 4x4 with a mosaic of k sub nxm with a specified pattern. However a 4x4 +4x4 should still be a 4x4? how does it go to 6x6? or is that K=K1+K2 = 36?
Azzi Abdelmalek
el 4 de Abr. de 2014
Editada: Azzi Abdelmalek
el 5 de Abr. de 2014
Mohammed you don't need a picture to post an example
Mohammed
el 4 de Abr. de 2014
Azzi Abdelmalek
el 5 de Abr. de 2014
Mohammed my name is Azzi, and I meant, for your case, you don't need to add a picture, just write your example
Mohammed
el 5 de Abr. de 2014
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 4 de Abr. de 2014
Just extract all the values and add them.
K = zeros(6); % Initialize
K(1,1) = K1(1,1) + K2(3, 1); % Sum up k11 values.
K(1,2) = K1(1,2) + K2(3, 2); % Sum up k12 values.
and so on for all 36 values. It's not rocket surgery - just pluck them out of where they're defined to be in each matrix and add them together. Simple as that.
1 comentario
Mohammed
el 4 de Abr. de 2014
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
