フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to do this

1 回表示 (過去 30 日間)
Ram k
Ram k 2016 年 7 月 5 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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.

回答 (1 件)

Thorsten
Thorsten 2016 年 7 月 5 日
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))

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by