Please post the code instead of an image of it. We can't do test with screenshots.
Your code is badly indented around the for/end blocks.
In for i
, each iteration overwrites xin
and fin
values.
Here is a working input example:
mode(1)
for i=1:3, xf(i,:) = evstr(input("Enter data x, value f : ","s")); end
Enter data x, value f : 2, 34
Enter data x, value f : 3, 11
Enter data x, value f : 5, 67
Then
--> xf
xf =
2. 34.
3. 11.
5. 67.
--> Mean = sum(prod(xf,"c"))/sum(xf(:,2))
Mean =
3.8928571