Hello,
Sexual problem or weakness is also known as erectile dysfunction. The causes are many like diabetes, depression, autonomic nervous system problem, excessive alcohol ingestion or tobacco smoking etc. You may need to consult your doctor to see which amongst these causes are responsible for your problem. Lifestyle choices like excessive smoking, being overweight and avoiding exercise are possible causes. In such cases quitting smoking, losing excessive weight, and increasing physical activity may help some men regain sexual function.
Please get it evaluated from a urologist.
I hope it helps. Take care and regards.