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 で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!