Borrar filtros
Borrar filtros

Matrix replications and form third matrix

2 visualizaciones (últimos 30 días)
Algorithms Analyst
Algorithms Analyst el 25 de Feb. de 2013
Hi everyone
I have two matrices A with size of (144x40) and B with same size.What I am trying to do is actually I want to take the square of them and add to form another matrix which is just a row or column with size of 1600.
A=144x400 B=144x1600.
D=A.^2+B.^2 .
So this D must be a column or row matrix with size of 1600x1 or 1x1600.
I have made a function
function D = repc(in,M,N)
D = in(repmat(1:size(in,1),M,1),repmat(1:size(in,2),N,1));
end
But when I compute A its size becomes double 20736x1600 and I cannot compute B because of out of memmory error
  2 comentarios
Matt J
Matt J el 25 de Feb. de 2013
Editada: Matt J el 25 de Feb. de 2013
Initially, you said that both A and B are 144x40. Later in your post, both matrices change size, to 144x400 for A and 144x1600 for B. In neither case is it clear what operation you would do to produce a length 1600 vector.
Please rephrase more clearly and with consistent information about size(A) and size(B).
Algorithms Analyst
Algorithms Analyst el 26 de Feb. de 2013
I am sorry it is my mistake.......it is 114*40

Iniciar sesión para comentar.

Respuestas (1)

Thorsten
Thorsten el 25 de Feb. de 2013
A = rand(144, 400);
B = rand(144, 1600);
A(size(B, 1), size(B, 2)) = 0;
D = A.^2 + B.^2;
size(D)

Categorías

Más información sobre Creating and Concatenating Matrices 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