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일

1 개 추천

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
.

댓글 수: 2

high speed
high speed 2022년 3월 6일
@Star Strider Thank you! That's what I need
Star Strider
Star Strider 2022년 3월 6일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

DGM
DGM 2022년 3월 6일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2022년 3월 6일

댓글:

2022년 3월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by