Before thinking about what you should do, you need to first understand why this pattern is occurring. First of all, you need to know that your behavior (depriving her of sex or affection) is an expression of your own angry feelings.
It is very possible that you aren't even in touch with how angry you are, and, as a result, that anger is being released through actions. The problem is that your actions lead your wife to feel angry with you. She gives you a hard time, which, in turn, makes you more angry.
Yes, you got it. You both are locked in a vicious cycle. The question is, how to break it.
First of all, you need to become aware of your angry feelings and talk about them, rather than act them out in ways that send your wife up the wall (and trigger more anger in you). Your wife also needs to become aware of and change what she is doing or saying to infuriate you. She needs to ask herself the question,'What am I doing to drive him away from me, and what can I do to bring him closer?'
Both of you would benefit by reading my book, Till Death Do Us Part (Unless I Kill You First), which will show both of you how to communicate your angry feelings in ways that bring you closer, rather than drive you farther and farther apart.
This problem can be resolved with hard work on both your parts.