how to increment an exponential in a diagonal

2 views (last 30 days)
Harnoor
Harnoor on 15 Jul 2022
Answered: KSSV on 15 Jul 2022
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.

Answers (1)

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

Categories

Find more on Operating on Diagonal Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!