Stress and other psychological factors can cause erectile dysfunction. When erectile dysfunction is caused by psychological factors, the male can achieve spontaneous erections when sleeping or early in the morning before going to the bathroom but cannot achieve an erection when making love.