Generate the Matrix! - MATLAB Cody - MATLAB Central

Problem 1671. Generate the Matrix!

Difficulty:Rate

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

49.82% Correct | 50.18% Incorrect
Last Solution submitted on Nov 17, 2024

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
2
3

Problem Recent Solvers124

Suggested Problems

Community Treasure Hunt

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

Start Hunting!