Create Matrix Please Help Me
Show older comments
Hello please help me I need a answer this question.
Write separately the following patterns (a), (b) the MATLAB program codes that can be created for any N value entered by the user, given as an example for the n= 6 value.

Answers (1)
This is one way
n = 6;
A = diag(1:n)
[bx by] = meshgrid(n:-1:1);
B = triu(by) + tril(bx,-1)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!