Summation of an array

1 vue (au cours des 30 derniers jours)
Barry Allen
Barry Allen le 5 Fév 2020
Commenté : Barry Allen le 6 Fév 2020
How can i code this in matlab?

Réponse acceptée

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH le 5 Fév 2020
if length(P) and length(Y) is N:
x=sum(P.*Y)
in another case:
N=5; %set any value for N
x=sum(P(1:N).*Y(1:N))
  1 commentaire
Barry Allen
Barry Allen le 6 Fév 2020
What if N is different?

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by