a=[1,3, 5, 7, 7, 7, 7, 5, 3, 1, 1, 1, 1, 1, 1];
len=length(a);
suma=sum(a);
sumb=0;
for i=1:1:len
sumb=sumb+i*a(i);
end
x=sumb/suma;
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
2024-09-30 19:38:54
a=[1,3, 5, 7, 7, 7, 7, 5, 3, 1, 1, 1, 1, 1, 1];
len=length(a);
suma=sum(a);
sumb=0;
for i=1:1:len
sumb=sumb+i*a(i);
end
x=sumb/suma;