Matrix replications and form third matrix
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Matt J
2013-2-25
编辑:Matt J
2013-2-25
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).
回答(1 个)
Thorsten
2013-2-25
A = rand(144, 400);
B = rand(144, 1600);
A(size(B, 1), size(B, 2)) = 0;
D = A.^2 + B.^2;
size(D)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!