Multiplication of array function

In the following line how can I use multiplication instead of "sum" ?
(sum(arrayfun(@(i)acos(S(i,i))^2,1:size(S,1)))) ;

 採用された回答

Voss
Voss 2023 年 8 月 26 日

1 投票

3 件のコメント

Voss
Voss 2023 年 8 月 26 日

Also, there is no need to use arrayfun because you can use diag to get the diagonal elements of S:

prod(acos(diag(S)).^2)
M
M 2023 年 8 月 27 日
@Voss Thanks!
Voss
Voss 2023 年 8 月 27 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeOperators and Elementary Operations についてさらに検索

質問済み:

M
M
2023 年 8 月 26 日

コメント済み:

2023 年 8 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by