create diagonal matrix zeros

4 views (last 30 days)
Ben Mai
Ben Mai on 28 Jan 2020
Answered: Ben Mai on 28 Jan 2020
I'm trying to create a matrix like this:
I'm able to create one matrix with a=diag(1:10)
and another with b=(1:10)+(0:9)'
But I don't know how to combine them together to get A.
Thanks for your help

Accepted Answer

the cyclist
the cyclist on 28 Jan 2020
a = diag(1:10);
a(1,:) = 1:10;
a(:,1) = 1:10;

More Answers (1)

Ben Mai
Ben Mai on 28 Jan 2020
Thank you :)

Categories

Find more on Operating on Diagonal 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!