create diagonal matrix zeros

조회 수: 4 (최근 30일)
Ben Mai
Ben Mai 2020년 1월 28일
답변: Ben Mai 2020년 1월 28일
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