Toeplitize a matrix - MATLAB Cody - MATLAB Central

Problem 42501. Toeplitize a matrix

Difficulty:Rate

Similar to Problem 3094. Hankelize a matrix, now consider Toeplitization of a matrix.

Given an input matrix A, convert it to a Toeplitz matrix B by replacing the diagonal of A with the mean of the respective diagonal. For example,

Input

   A = [6     3     2     7
        3     5     1     2
        3     7    10     2]

Output:

   B = [7     2     2     7 
        5     7     2     2
        3     5     7     2]

Solution Stats

45.94% Correct | 54.06% Incorrect
Last Solution submitted on Jun 04, 2025

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 Solvers130

Suggested Problems

More from this Author29

Community Treasure Hunt

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

Start Hunting!