FFT Background subtraction in MATLAB
I'm assuming since you didn't say that you're working with audio. But my answer generally applies if you're working with images/video as well. Unless the background you're trying to subtract is exactly the same, I doubt subtracting a phase-inverted version of the signal will work. It sounds like what you're trying to perform is spectral subtraction. This is a common technique where you simply subtract the average FFT magnitude spectrum from your signal. See this paper on spectral subtraction. If working with images/video, I assume that you could do this in 2 dimensions as well and the math would be similar.