Creating Matrix Using Existing Matrix
11 ビュー (過去 30 日間)
古いコメントを表示
Hi, How do you create a matrix (not just a plot) that is a horizontal shear of a 2x2 identity matrix? For example, how do you create A=[1 2 ; 0 1] (identity horizontally sheared by 2)? Inputting the entries directly (A=[1 2 ; 0 1]) is not an answer that I'm looking for.
Thank you.
0 件のコメント
採用された回答
Walter Roberson
2015 年 10 月 6 日
SheerFactor = 2;
sheermat = eye(2);
sheermat(1,2) = SheerFactor;
0 件のコメント
その他の回答 (2 件)
Andrei Bobrov
2015 年 10 月 6 日
n - size matrix
full(spdiags(ones(n,1)*(0:2*n-1),1-n:n-1,n,n))
or
rot90(hankel(0:n-1,n-1:2*n-2))
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!