Normally erectile dysfunction
in middle age is generally due to causes like overwork, stress, guilt and bereavement (ED often happens when a widowed man tries to form a new sexual relationship),diabetes
,smoking,use of recreational drugs etc.
But a erectile dysfunction at such a young age is most likely the result of anxiety – particularly nervousness
about having sex, about causing a pregnancy
or about using a condom.
A lot of men in this age group complain that they 'can't get on with a condom' because as soon as they try to put it on, they lose their hardness. This is called as have 'condom collapse syndrome'.
Other common psychological causes of erection difficulties include:
About performance related
guilt – notably if you're trying to have sex with somebody else's wife
relationship problems – especially if you're no longer keen on your partner
latent gayness – for instance, if you’re a basically gay guy, trying to have sex with a woman
In a lot of cases, ED turns out to be due to a mixture of psychological and physical causes.
My advise to you is simply relax,do regular aerobic exercises,go for mental relaxation techniques
like deep breathing exercises,pranayama and yoga,quitting smoking and recreational drugs and reduce alcohol,if taking.
This in itself should make you all right in next couple of months.
However if you don't find improvement,consult a doctor and/or a counsellor.