Create Matrix Please Help Me
显示 更早的评论
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.

回答(1 个)
This is one way
n = 6;
A = diag(1:n)
[bx by] = meshgrid(n:-1:1);
B = triu(by) + tril(bx,-1)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!