Matlab n阶矩阵行、列互换

>>
>> Z2=eye(4,4)

Z2 =

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

>>
>>
>>

>>
>> Z2([2,3],:)=Z2([3,2],:)

Z2 =

1 0 0 0
0 0 1 0
0 1 0 0
0 0 0 1

>>
>>
>> A2=[1,2,3,4;2,3,4,5;3,4,5,6;4,5,6,7]

A2 =

1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7

>>
>>
>> N2=A2*Z2

N2 =

1 3 2 4
2 4 3 5
3 5 4 6
4 6 5 7

>>
>>
>> N3=Z2*A2

N3 =

1 2 3 4
3 4 5 6
2 3 4 5
4 5 6 7

>>
>>

posted @ 2020-04-21 08:56  西北逍遥  阅读(1241)  评论(0编辑  收藏  举报