How do we create weighted average for a matrix?

1 view (last 30 days)
Hello,
I have a matrix e.g
[ 5 3 3 1
3 4 5 2
5 0 0 0
3 4 5 2]
For this matrix I have to make a weighted average for each row. That is, [5+3+(4/5)*(3+1)] / 4=16/5. Also if there is only one number and the rest zero (row 3), the weighted average should be (5+0+0+0) / 1=5 and in the end we choose the largest weighted average.
I would appreciate it very much if someone helped me!!!

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!