How make this matrix using for loop?

1 次查看(过去 30 天)
-1 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0
-1 -1 0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0 0 0 0 0
-1 -1 -1 0 0 0 0 0 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0 0 0 0 0 0
-1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0 0 0 0 0 0
-1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0 0

采纳的回答

Stephen23
Stephen23 2017-9-20
Why use a loop?
>> M = zeros(10,14);
>> M(1:2:end,1:5) = -tril(ones(5));
>> M(2:2:end,1:5) = +tril(ones(5));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!