here you are .
Q andy must be indexed in the loop (Q(k) , y(k))
only one Q variable suffice for all cases - no need to create multiple Q's
also please don't use i or j for loop index as your are shadowing their native role (i = j = sqrt(-1) for complex numbers)
elseif (y(k) > 10) && (y(k)<100)