I found that my heart beat irregularly if I drank too much caffeinated soda, which I am more likely to drink when I want to relax. Have you looked into a dietary link like that? In other words, tension causes you to eat or drink some particular thing, and that might be implicated in your ectopic beats?
I'm just trying to figure out what could be causing these ectopic beats, since they hadn't come about until me getting anxiety.
It also causes fluctuations in blood sugar, which might make you feel more or less anxious. As to vitamin levels, that would depend on how long your "courses" are -- fasting is actually quite cleansing, but an anxious person might have that blood sugar effect that makes one feel a bit dizzy and associate it with anxiety. I would say that's more of a problem if these "courses" are short term. But deficiencies in the diet of certain nutrients can be a factor in causing anxiety in the first place, particularly magnesium and, as mentioned, the Bs, as well as the amino acids responsible for manufacturing the neurotransmitters involved in proper mental functioning.
It wouldn't hurt for you to take good vitamins scrupulously when you are not eating regularly. Whether anxiety depletes vitamins or not (and it wouldn't be surprising if it does erode especially the Bs) the fact of eating irregularly is not good for your vitamin flow.