create diagonal matrix zeros

3 次查看(过去 30 天)
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

采纳的回答

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

更多回答(1 个)

Ben Mai
Ben Mai 2020-1-28
Thank you :)

类别

Help CenterFile Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by