练习二
eye(5,3)
ans =
1 0 0
0 1 0
0 0 1
0 0 0
0 0 0
>> a=eye(3,3)
a =
1 0 0
0 1 0
0 0 1
>> c=a;
>> d=diag(a)
d =
1
1
1
>> D=diag(d)
D =
1 0 0
0 1 0
0 0 1
>> a=rand(3,3)
a =
0.8147 0.9134 0.2785
0.9058 0.6324 0.5469
0.1270 0.0975 0.9575
>> a
a =
0.8147 0.9134 0.2785 0
0.9058 0.6324 0.5469 0
0.1270 0.0975 0.9575 0
3.0000 43.0000 54.0000 5.0000
>> c=logspace(0,6,8)
c =
1.0e+06 *
0.0000 0.0000 0.0001 0.0004 0.0027 0.0193 0.1389 1.0000
>> a=diag(c)
a =
1.0e+06 *
0.0000 0 0 0 0 0 0 0
0 0.0000