Impotence, or erectile dysfunction, is the inability of a male to attain and keep an erection sufficiently firm to engage in or complete sexual intercourse. Although it is more common in older men, impotence can occur at any age. Impotence is not a normal consequence of aging. About 70% of erectile dysfunction is due to diseases such as diabetes and atherosclerosis, another 10% to 20% is due to psychological factors, and the remaining percentage is related to medications, lifestyle factors, and injury (Source: NIDDK).
Another common problem for men who have trouble in the bedroom is substance use or abuse. In some cases, a man suffering from erectile dysfunction may be diagnosed with depression and be prescribed selective serotonin reuptake inhibitors, or SSRIs. These medications may be able to assist in alleviating the symptoms of depression, but they can also lead to erectile dysfunction.
Cosgrove et al reported a higher rate of sexual dysfunction in veterans with posttraumatic stress disorder (PTSD) than in veterans who did not develop this problem.  The domains on the International Index of Erectile Function (IIEF) questionnaire that demonstrated the most change included overall sexual satisfaction and erectile function. [43, 44] Men with PTSD should be evaluated and treated if they have sexual dysfunction.
While we may think the penis has a mind of it’s own, it’s actually heavily dependent to the brain, and too much stress can interfere with a man’s ability to obtain and hold an erection. According to Healthline, stress can interrupt how your brain sends messages to the penis to allow extra blood flow. Even though a man may want to have sex, too much stress can make this impossible.
One study examined the role of testosterone supplementation in hypogonadal men with ED. These men were considered nonresponders to sildenafil, and their erections were monitored by assessing nocturnal penile tumescence (NPT). After these men were given testosterone transdermally for 6 months, the number of NPTs increased, as did the maximum rigidity with sildenafil.  This study suggests that a certain level of testosterone may be necessary for PDE5 inhibitors to function properly.
The symptoms of erectile dysfunction include difficulty achieving an erection, trouble maintaining an erection, and a reduced interest in sex. Because male sexual arousal is a fairly complex process, it can sometimes be difficult to identify a specific cause. Arousal starts in the brain but it also involves the nerves, muscles, and blood vessels and can be impacted by hormones and emotions. If a problem develops with any of these things, erectile dysfunction could be the consequence.
The severity of ED has been correlated with the extent of CVD. Banks et al reported that the risk of future CV events increased progressively according to ED severity.28 This was shown in both men with and without known CVD at baseline and after controlling for confounders. Solomon and colleagues found an inverse correlation between international index of erectile function (IIEF) scores and plaque burden seen on coronary angiography.29 In addition, Yaman et al demonstrated a significant correlation between ED severity on IIEF questionnaires and coronary artery calcification.30
The Massachusetts Male Aging Study (MMAS) documented an inverse correlation between ED risk and high-density lipoprotein (HDL) cholesterol levels but did not identify any effect from elevated total cholesterol levels.  Another study involving male subjects aged 45-54 years found a correlation with abnormal HDL cholesterol levels but also found a correlation with elevated total cholesterol levels. The MMAS included a preponderance of older men.
So here’s something that’s really fascinating. Healthy eating is a way to reduce anxiety and stress. Now how, you may be asking, right? Well, think about it. We live in a world where there are so many variables and where we don’t have control over our lives. But now, with healthy eating, we have control over what goes into our body. And now having that control empowers us to be even healthier, to be more directive in what we do. And certainly, that begins then to reduce the anxiety and the stress. So all in one, you have a healthier body, but certainly a healthier mind.
The primary nerve fibers to the penis are from the dorsal nerve of the penis, a branch of the pudendal nerve. The cavernosal nerves are a part of the autonomic nervous system and incorporate both sympathetic and parasympathetic fibers. They travel posterolaterally along the prostate and enter the corpora cavernosa and corpus spongiosum to regulate blood flow during erection and detumescence. The dorsal somatic nerves are also branches of the pudendal nerves. They are primarily responsible for penile sensation. 
Having erection trouble from time to time isn't necessarily a cause for concern. If erectile dysfunction is an ongoing issue, however, it can cause stress, affect your self-confidence and contribute to relationship problems. Problems getting or keeping an erection can also be a sign of an underlying health condition that needs treatment and a risk factor for heart disease.