This is a medical question of type : causes 
 What causes What I need to know about Erectile Dysfunction ? 
 To find the cause of your ED, your doctor may
                
- take your medical and sexual history  - ask you questions about your mental health  - give you a physical exam  - test your blood  - give you a nighttime erection test  - perform an injection test  - perform a Doppler penile ultrasound
                
Medical and Sexual History
                
Your doctor will ask general questions about your health, as well as specific questions about your erection problems and your relationship with your sexual partner. Your doctor might ask you questions such as
                
- Have you ever had surgery?  - What medicines do you take?  - How sure are you that you can get and keep an erection?  - When you have erections, how often are they hard enough for sex?  - During sex, how often are you able to keep your erection?  - When you try to have sex, how often are you happy with the sex?  - How would you rate your level of sexual desire?  - How often are you able to reach climax and ejaculate?  - Do you have an erection when you wake up in the morning?  - Do you use illegal drugs, drink alcohol, or smoke?
                
The answers to these questions will help your doctor understand the problem.
                
Bring a list of all the medicines you take, or the actual medicines, to show to your doctor.
                
Mental Health Questions
                
Your doctor may ask you questions about your mental health. For example, the doctor may ask if you feel nervous or depressed. He or she may also ask you to answer questions on paper. The doctor may also ask your sexual partner questions to get more information about the problem.
                
Physical Exam
                
A physical exam can help your doctor find the cause of your ED. As part of the exam, the doctor will examine your testes and penis, take your blood pressure, and check for problems with your blood flow.
                
Blood Tests
                
A blood test involves drawing your blood at a doctors office or a commercial facility and sending the sample to a lab for analysis. Blood tests can show possible causes of ED, such as diabetes, clogged blood vessels, or chronic kidney disease. Low levels of testosterone in your blood can explain why you may have lost interest in sex.
                
Nighttime Erection Test
                
During a nighttime erection test, you wear a plastic band around your penis to test whether you have nighttime erections. The band easily breaks if your penis expands. This test shows if you had at least one erection during the night. Another test uses an electronic device that can record the number of erections, how long they last, and how firm they are. A man normally has three to five erections during the night while he sleeps. If you do have an erection, it probably means that your ED is more likely a mental health issue. If you do not have these erections, you probably have nerve damage or poor blood flow to your penis. You may do this test in your home or in a special sleep lab.
                
Injection Test
                
During an injection test, the doctor will inject a medicine into your penis to cause an erection. If the erection is not firm or does not last, it may mean you have a problem with blood flow. This test most often takes place in the doctors office.
                
Doppler Penile Ultrasound
                
An x-ray technician most often performs a Doppler penile ultrasound in a doctors office or an outpatient center. During a Doppler penile ultrasound, the x-ray technician or doctor lightly passes a device over your penis to create images of blood vessels in your penis. An injection is used to create an erection. The images can show if you have a blood flow problem. The pictures appear on a computer screen. A radiologista doctor who specializes in medical imaginglooks at the images to find possible problems.