how to increment an exponential in a diagonal

3 次查看(过去 30 天)
I want to create a matrix with exponents in the diagonal. The first exponent is e^-1, then e^-1/2, e^-1/3... all the way to e^-1/19.

回答(1 个)

KSSV
KSSV 2022-7-15
A = exp(-1./(1:19)) ;
iwant = diag(A)

类别

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