Error in my code

Dividing two integers can result in a non-integer.

julia> 4/3
1.3333333333333333

You are then trying to put that non-integer into an array of integers, but Julia doesn’t know how you want to round it, so it throws an InexactError.

julia> Int[4/3]
ERROR: InexactError: Int64(1.3333333333333333)

You need to round the result yourself first.

julia> Int[round(Int,4/3)]  # round to nearest
1-element Vector{Int64}:
 1

julia> Int[ceil(4/3)]      # round up
1-element Vector{Int64}:
 2

julia> Int[floor(4/3)]     # round down
1-element Vector{Int64}:
 1

Please read this post to make it easier to help you next time. (It is hard to read your code and the plotting lines are irrelevant to your problem.)