Here is one way using base R, change the hst
variable to your desired sublength (just to be clear, the first coefficient is estimated based on values with indices 1,2,3; the second coefficient is estimated based on values with indices 4,5,6)
Q=as.numeric(read.table(text="49 44 34 33 37 48 20 48 37 42 44 35 40"))
hst=3
sapply(seq(1,length(Q),hst),function(x){
tmp=x:(pmin(x+hst-1,length(Q)))
q1=quantile(Q[tmp],0.25)
q3=quantile(Q[tmp],0.75)
as.numeric((q3-q1)/(q3+q1))
})
[1] 0.08771930 0.09677419 0.19718310 0.05521472 0.00000000
As mentioned in the comments, you should really use more data to when estimating the coefficient.
If you want to estimate based on a rolling window, so indices 1,2,3 -> 2,3,4 -> ... just replace seq(1,length(Q),hst)
with seq(1,length(Q),1)
.