Problem 1671. Generate the Matrix!

Given n, generate the following matrix:

a = [ n  n-1 n-2 ... 2 1;
     n-1 n-1 n-2 ... 2 1;
     n-2 n-2 n-2 ... 2 1;
      .   .   .   .  . .;
      .   .   .   .  . .;
      .   .   .   .  . .;
      2   2   2  ... 2 1;
      1   1   1  ... 1 1]

Good luck!

Solution Stats

50.0% Correct | 50.0% Incorrect
Last Solution submitted on Nov 29, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers125

Suggested Problems

Community Treasure Hunt

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

Start Hunting!