Summation of an array

2 views (last 30 days)
Barry Allen
Barry Allen on 5 Feb 2020
Commented: Barry Allen on 6 Feb 2020
How can i code this in matlab?

Accepted Answer

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH on 5 Feb 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))

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!