I had inexplicable ED sometimes. First, with my GFs I would compensate by getting good at going down on them and delighting them and me with giving oral sex. But of course that doesn't replace intercourse and eventually I'd lose the girl.I got over this mostly when I first met a girl that I ended up marrying. I still have ED now and then for no particular reason but here is what helped me: The bottom line is to realize that "I" had no control over my penis at all. It would do what it did. I realized that really and truly whether I ever maintained another erection in my whole life wasn't something "I" could dictate to my penis.
And I would watch and see what happened. My anxiety dissipated quite a lot from that and led to my losing my anxiety and resulting ED most of the time.
That realization led to a lightness that really helps reduce anxiety with regard to getting hard or not, in general. I just watch and see what happens with my penis and give it its life. Whether it wants to be erect or not is its business more than mine. It sounds strange but it really works this way.
Also I highly recommend you read about soft entry and karezza as this reduced my anxiety and opened up a new world that is far, far better than regular sex ever was. And this all de-pressurizes the situation because even if you can't perform at first, often you end up being able to perform by entering your GF while still soft and then seeing what happens. It's really great.
I used to have bouts of ED for maybe 3 or 5 days, during which time it was all I could think about. That doesn't happen anymore, ever. It's been years. I decided that the point of sex is to just be there with her and let my penis do whatever it wants. Karezza has become a focus of my life and there is no "wrong" or real difficulty with it. It's quite sweet.
I can't imagine going through 7 years of not having sex with my wife. I can't go more than 2 or 3 days without really wanting her. I don't sleep with her, haven't for years for specific health reasons. But we go to bed together every night until she is ready to fall asleep, and I always try to cuddle or have sex in the morning when she wakes up.
I emphasize that all my sexual concerns and worries (and there were many) have gone away. If I had to start over with another woman, I may or may not have a few issues sexually but I am sure it wouldn't matter to me the way it used to.
Even masturbation is not really possible for me anymore. I have zero interest. I can get an erection with self stimulation but I have zero interest in continuing that process.
But every day, when I wake up, I think of my wife. I close my eyes and imagine her, being naked with me. But it is not sexual really, it's hard to describe. I had that feeling early on with some girls that I dated a long time ago. Now I have it every day. It is so fine to sit and imagine her with me. It is amazing but I wouldn't call it a fantasy although I suppose it is. It's a karezza fantasy but doesn't involve penis in vagina, just thinking of her and her smell and feel and presence.
I'm so lucky I can't believe it.