It turns out that the variable m is positive in most of its range, but is negative for the array elements
>> [min(find(m<0)) max(find(m<0))]
because the denominator of the expression for m is negative and the numerator is positive. Since you define q as
q = 0 in that region. The 2nd and 3rd terms contain a factor of s/q, so the 2nd and 3rd terms are infinite in that region, and subtracting the 2nd and 3rd terms means that the result has nans in that region. You can plot result or RESULT since plotting ignores nans. But the ifft doesn't work.
So you will need to decide what q should be doing when m is negative.