summation of 2 separate matrix

1 view (last 30 days)
salman
salman on 16 Nov 2014
Commented: salman on 16 Nov 2014
hi can anyone help me out with this problem i am having
x=[1 2 3 4 5];
y=[5 23 44 14];
i want to find the summation of x*y^2 so i am using loop function but my result come as 1
i=0;
for i=i+1
i<5;
d=0;
c=sum(x(i)*y(i)^2);
d=d+c;
end
>> d=.
can anyone please correct me where i am making mistake
thank you

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 16 Nov 2014
Edited: Azzi Abdelmalek on 16 Nov 2014
x=[1 2 3 4 ];
y=[5 23 44 14];
out=sum(x.*y.^2)

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!