I suspect you want
## generate next filter order
if i==1
a[i] = g
else
a[i-1:-1:1] = a[i-1:-1:1]-g*a[i-1:-1:1] # **** this is my problem
area*****
end
a is first assigned as a Vector{Float64} of length p. Then you did a=g
which assigns a as a Float64 (this is bad for performance as well, since
it's not type stable). Then you try to a[1] when i=2, but in Julia (unlike
MATLAB, and I assume octave) that is not a valid access. You want to make
sure a stays as a Vector{Float64} the whole time, and while you can change
the length if you want, you will probalby be better off if you keep it the
same length as well.