First, and let's be honest here, sex can be stressful. Many men feel anxious about it, wondering if they're good enough, second-guessing themselves, often getting to the point of wanting to avoid sex altogether. These thoughts and feelings interfere with your arousal, distract you, and lead to weaker erection or no erection at all.
Other sex-related issues might revolve around your sexual partner and your relationship. These might be a little harder to address since they involve two people, but there is nothing honest, straight-forward communication cannot fix.
Psychology and relationships aside, in many cases ED can be caused by a medical condition. The underlying disorder might be vascular, hormonal, inflammatory, or nervous system-related.
It is strongly recommended you consult with your physician to find out the real cause of your health concerns and make sure that you are properly addressing them.