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. You should avoid alcohol and smoking, take healthy food, do sensual exercise, counseling done by a psychologist. You can do some regular exercise in form of yoga, shed weight and have a proper sleep.
I hope it helps. Take care and regards.
If your healthy, then primarily it all depends on your mood and focus. Do you see any weakness in your pelvic muscles? Google for Kejal exercise or Pelvic floor exercises, which helps in strengthening the pelvic muscles, and a simple method for treating erectile dysfunction.
If you unable to succeed, it is better you check with your Andrologist.