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

 Respuesta aceptada

Voss
Voss el 26 de Ag. de 2023

1 voto

3 comentarios

Voss
Voss el 26 de Ag. de 2023

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 el 27 de Ag. de 2023
@Voss Thanks!
Voss
Voss el 27 de Ag. de 2023
You're welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Operators and Elementary Operations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

M
M
el 26 de Ag. de 2023

Comentada:

el 27 de Ag. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by