Subtracting Two Matrices of different sizes
Mostrar comentarios más antiguos
How do I do the following subtraction: let X = [302 64] where all values in X are either 0s or 1s
A= X - X';
A=[302 64] - [64 302];
How do I find subtract these?
3 comentarios
Walter Roberson
el 18 de Dic. de 2015
What size are you expecting the result to be?
For any one entry in the result, say A(J,K), how should A(J,K) be computed?
AR
el 18 de Dic. de 2015
Walter Roberson
el 18 de Dic. de 2015
For any one entry in the result, say A(J,K), how should A(J,K) be computed?
Respuesta aceptada
Más respuestas (1)
Renato Agurto
el 18 de Dic. de 2015
Hi
do you mean something like this?
%A,B: inputs matrices
%C output matrix
N = max([size(A,1) size(B,1)]);
M = max([size(A,2) size(B,2)]);
An = zeros(N,M);
Bn = zeros(N,M);
An(1:size(A,1), 1:1:size(A,2)) = A;
Bn(1:size(B,1), 1:1:size(B,2)) = B;
C = An-Bn
1 comentario
AR
el 20 de Dic. de 2015
Categorías
Más información sobre Resizing and Reshaping 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!