simplifying kinda-eye matrix of NxN, how?
1 次查看(过去 30 天)
显示 更早的评论
greetings, here's the problem:
i have a matrix like this:
A = [cosx_X cosx_Y cosx_Z
cosy_X cosy_Y cosy_Z
cosz_X cosz_Y cosz_Z]
cosx_X = alp(d,1);cosx_Y = alp(d,2);cosx_Z = alp(d,3);
cosy_X = alp(d,4);cosy_Y = alp(d,5);cosy_Z = alp(d,6);
cosz_X = alp(d,7);cosz_Y = alp(d,8);cosz_Z = alp(d,9);
t = [cosx_X cosx_Y cosx_Z 0 0 0 0 0 0 0 0 0;
cosy_X cosy_Y cosy_Z 0 0 0 0 0 0 0 0 0;
cosz_X cosz_Y cosz_Z 0 0 0 0 0 0 0 0 0;
0 0 0 cosx_X cosx_Y cosx_Z 0 0 0 0 0 0;
0 0 0 cosy_X cosy_Y cosy_Z 0 0 0 0 0 0;
0 0 0 cosz_X cosz_Y cosz_Z 0 0 0 0 0 0;
0 0 0 0 0 0 cosx_X cosx_Y cosx_Z 0 0 0;
0 0 0 0 0 0 cosy_X cosy_Y cosy_Z 0 0 0;
0 0 0 0 0 0 cosz_X cosz_Y cosz_Z 0 0 0;
0 0 0 0 0 0 0 0 0 cosx_X cosx_Y cosx_Z;
0 0 0 0 0 0 0 0 0 cosy_X cosy_Y cosy_Z;
0 0 0 0 0 0 0 0 0 cosz_X cosz_Y cosz_Z ];
any tips for simplify the writing of matrix? any guidance will help me alot, thanks
0 个评论
采纳的回答
KSSV
2022-7-10
A = rand(3) ;
[m,n] = size(A) ;
iwant = zeros(4*m,4*n) ;
for i = 1:4
idx = (1:m)+(i-1)*3 ;
iwant(idx,idx)=A;
end
spy(iwant)
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!