Create a specific matrix (MATLAB)

7 次查看(过去 30 天)
Dear members
I want create a square matrix in such a way that I got the general form:
For example if we have m=4, we got:
How can I program that please!

采纳的回答

Star Strider
Star Strider 2022-3-6
Try this —
M = hankel(1:4,4:-1:1)
M = 4×4
1 2 3 4 2 3 4 3 3 4 3 2 4 3 2 1
.

更多回答(1 个)

DGM
DGM 2022-3-6
This is one way:
A = flipud(toeplitz([4 3 2 1]))
A = 4×4
1 2 3 4 2 3 4 3 3 4 3 2 4 3 2 1

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by