Inability to get and keep penile erection occurs in many men. This usually indicates erectile dysfunction (ED). ED is highly linked with underlying non-pathological problems especially anxiety and stress, alcohol, and exhaustion. It is surely ED if you are able to get and keep erection during masturbation but not when you are with your partner. This is usually due to sexual performance anxiety. Other causes include cardiovascular disorders, diabetes and hypertension.