identity matrix nth order
1 次查看(过去 30 天)
显示 更早的评论
Jasneet Singh
2021-3-19
n = [1:1:20];
M=eye(n).*0.02
its not working !! i got an error that says eye() can't draw n dimensional arrays..can it be corrected ?
if not is there any other alternative to this?
回答(2 个)
ANKUR KUMAR
2021-3-19
编辑:ANKUR KUMAR
2021-3-19
n=20;
eye(n) % identity matrix of order 20
eye(randi(50,1,1)) % identity matrix of a random order generated by randi
VBBV
2022-2-27
n = [1:1:20];
for k = 1:length(n)
M{k}=eye(n(k)).*0.02;
X = sprintf('Identity matrix of order %0d',k);
disp(X)
I = M{k}
end
Identity matrix of order 1
I = 0.0200
Identity matrix of order 2
I = 2×2
0.0200 0
0 0.0200
Identity matrix of order 3
I = 3×3
0.0200 0 0
0 0.0200 0
0 0 0.0200
Identity matrix of order 4
I = 4×4
0.0200 0 0 0
0 0.0200 0 0
0 0 0.0200 0
0 0 0 0.0200
Identity matrix of order 5
I = 5×5
0.0200 0 0 0 0
0 0.0200 0 0 0
0 0 0.0200 0 0
0 0 0 0.0200 0
0 0 0 0 0.0200
Identity matrix of order 6
I = 6×6
0.0200 0 0 0 0 0
0 0.0200 0 0 0 0
0 0 0.0200 0 0 0
0 0 0 0.0200 0 0
0 0 0 0 0.0200 0
0 0 0 0 0 0.0200
Identity matrix of order 7
I = 7×7
0.0200 0 0 0 0 0 0
0 0.0200 0 0 0 0 0
0 0 0.0200 0 0 0 0
0 0 0 0.0200 0 0 0
0 0 0 0 0.0200 0 0
0 0 0 0 0 0.0200 0
0 0 0 0 0 0 0.0200
Identity matrix of order 8
I = 8×8
0.0200 0 0 0 0 0 0 0
0 0.0200 0 0 0 0 0 0
0 0 0.0200 0 0 0 0 0
0 0 0 0.0200 0 0 0 0
0 0 0 0 0.0200 0 0 0
0 0 0 0 0 0.0200 0 0
0 0 0 0 0 0 0.0200 0
0 0 0 0 0 0 0 0.0200
Identity matrix of order 9
I = 9×9
0.0200 0 0 0 0 0 0 0 0
0 0.0200 0 0 0 0 0 0 0
0 0 0.0200 0 0 0 0 0 0
0 0 0 0.0200 0 0 0 0 0
0 0 0 0 0.0200 0 0 0 0
0 0 0 0 0 0.0200 0 0 0
0 0 0 0 0 0 0.0200 0 0
0 0 0 0 0 0 0 0.0200 0
0 0 0 0 0 0 0 0 0.0200
Identity matrix of order 10
I = 10×10
0.0200 0 0 0 0 0 0 0 0 0
0 0.0200 0 0 0 0 0 0 0 0
0 0 0.0200 0 0 0 0 0 0 0
0 0 0 0.0200 0 0 0 0 0 0
0 0 0 0 0.0200 0 0 0 0 0
0 0 0 0 0 0.0200 0 0 0 0
0 0 0 0 0 0 0.0200 0 0 0
0 0 0 0 0 0 0 0.0200 0 0
0 0 0 0 0 0 0 0 0.0200 0
0 0 0 0 0 0 0 0 0 0.0200
Identity matrix of order 11
I = 11×11
0.0200 0 0 0 0 0 0 0 0 0 0
0 0.0200 0 0 0 0 0 0 0 0 0
0 0 0.0200 0 0 0 0 0 0 0 0
0 0 0 0.0200 0 0 0 0 0 0 0
0 0 0 0 0.0200 0 0 0 0 0 0
0 0 0 0 0 0.0200 0 0 0 0 0
0 0 0 0 0 0 0.0200 0 0 0 0
0 0 0 0 0 0 0 0.0200 0 0 0
0 0 0 0 0 0 0 0 0.0200 0 0
0 0 0 0 0 0 0 0 0 0.0200 0
Identity matrix of order 12
I = 12×12
0.0200 0 0 0 0 0 0 0 0 0 0 0
0 0.0200 0 0 0 0 0 0 0 0 0 0
0 0 0.0200 0 0 0 0 0 0 0 0 0
0 0 0 0.0200 0 0 0 0 0 0 0 0
0 0 0 0 0.0200 0 0 0 0 0 0 0
0 0 0 0 0 0.0200 0 0 0 0 0 0
0 0 0 0 0 0 0.0200 0 0 0 0 0
0 0 0 0 0 0 0 0.0200 0 0 0 0
0 0 0 0 0 0 0 0 0.0200 0 0 0
0 0 0 0 0 0 0 0 0 0.0200 0 0
Identity matrix of order 13
I = 13×13
0.0200 0 0 0 0 0 0 0 0 0 0 0 0
0 0.0200 0 0 0 0 0 0 0 0 0 0 0
0 0 0.0200 0 0 0 0 0 0 0 0 0 0
0 0 0 0.0200 0 0 0 0 0 0 0 0 0
0 0 0 0 0.0200 0 0 0 0 0 0 0 0
0 0 0 0 0 0.0200 0 0 0 0 0 0 0
0 0 0 0 0 0 0.0200 0 0 0 0 0 0
0 0 0 0 0 0 0 0.0200 0 0 0 0 0
0 0 0 0 0 0 0 0 0.0200 0 0 0 0
0 0 0 0 0 0 0 0 0 0.0200 0 0 0
Identity matrix of order 14
I = 14×14
0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0.0200 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0.0200 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0.0200 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0.0200 0 0 0 0
Identity matrix of order 15
I = 15×15
0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0.0200 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0.0200 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0.0200 0 0 0 0 0
Identity matrix of order 16
I = 16×16
0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0.0200 0 0 0 0 0 0 0 0 0 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0 0 0.0200 0 0 0 0 0 0 0 0
Identity matrix of order 19
I = 19×19
0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0
Identity matrix of order 20
I = 20×20
0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0.0200 0 0 0 0 0 0 0 0 0 0
Try using a loop
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)