Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

How to do this

1 vue (au cours des 30 derniers jours)
Ram k
Ram k le 5 Juil 2016
Clôturé : MATLAB Answer Bot le 20 Août 2021
Suppose I have a matrix with some entries zero and some are nonzero.
0.36 0 0.9 0.4
0.26 0.1 0 0
0.5 0 0 0.8
0.6 0.75 0.4 0.88
I have to take log of nonzero numbers and then I have to add it, i.e. log(0.36)+log(0.9)+log(0.4)+log(0.26)+log(0.1)+log(0.5)+log(0.8)+log(0.6)+log(0.75)+log(0.4)+log(0.88), how to do.

Réponses (1)

Thorsten
Thorsten le 5 Juil 2016
A = [0.36 0 0.9 0.4
0.26 0.1 0 0
0.5 0 0 0.8
0.6 0.75 0.4 0.88];
sum(log(A(A ~= 0))

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by