adding matrices with different dimensions
古いコメントを表示
I got an equation similar to this : X-sin(thita). size(X) = 1x50 size(thita) = 1x180.
My output should be a matrix of 50x180. It could be done easily by using 2 for-loop but i am trying to find something more efficient. I tried bsxfun() but i could not manage it.
Thanks in advance
採用された回答
その他の回答 (1 件)
Mischa Kim
2014 年 9 月 12 日
Dimitrios, you mean something like
X = 1:50;
theta = (1:180)*pi/180;
mat = repmat(X',1,numel(theta)) - repmat(sin(theta),numel(X),1);
1 件のコメント
David Young
2014 年 9 月 12 日
It's a good idea to use .' rather than ' for transposing X, because ' takes the complex conjugate. We don't know for sure that X is always real.
カテゴリ
ヘルプ センター および 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!