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)))) ;

 Accepted Answer

Voss
Voss on 26 Aug 2023

3 Comments

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)
@Voss Thanks!
You're welcome!

Sign in to comment.

More Answers (0)

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Asked:

M
M
on 26 Aug 2023

Commented:

on 27 Aug 2023

Community Treasure Hunt

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

Start Hunting!