I would like to have a function which would generate vectors of the same length and average them together into a single vector. I can’t quite understand why the following example wouldn’t work (the value of vector remains the same as initially assigned in the second line):
function f(N)
vector = rand(3)
for n in 2:N
v = rand(3)
(vector).+v
display(vector)
end
(vector)./N
return vector
end
display(f(5))