I'm trying to use movfun (moving window) in octave
x = -1000:0.1:1000
y = sin(x)
movfun(@(arg) printf("%d\n", size(arg)), y(1:100), 4)
I expect to see all 4s
However, surprisingly (to me) I get:
4
1
4
97
2
1
3
1
3
1
ans =
Columns 1 through 29:
4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
Columns 30 through 58:
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
Columns 59 through 87:
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
Columns 88 through 100:
5 5 5 5 5 5 5 5 5 5 5 5 4
What is wrong with my expectations?