Talk to most teenage guys and you'll find that their erections seem to have a mind of their own - popping up when least expected or perhaps at a less-than-opportune time. But for many men, the opposite can be just as disconcerting - desperately wanting to have an erection at a particular moment, and finding no cooperation from the involved member. It seems that erections can be quite finicky and are affected by a multitude of factors.
After puberty, testosterone levels are usually at their highest, driving competitiveness, aggression, and sexuality. It seems that almost anything from nervousness, to excitation, to daydreaming, to boredom can trigger an erection. For many teenage guys, masturbating daily or even several times a day is common without untoward consequences.
Then we cut to a sexual situation. Maybe there is the expectation of having sex with a partner that is very attractive and exciting, so much so that a guy becomes anxious about his ability to please his partner. If his anxiety starts to overshadow his excitement, he may not be able to keep an erection or even get one at all. Once the anxiety becomes the predominating thought, not only does it flood the system with adrenaline, but it leaves little room for real erotic thoughts that drive arousal.
What kind of response a guy gets to his level of arousal can also greatly influence the level of his erection or ability to maintain it. A strong, judgmental, hysterical, or demanding attitude on the part of his partner is not only insensitive, but works directly against his arousal and can make the situation even worse. The more that a guy can continue to focus primarily on what he finds exciting without getting pressure from his partner or from his own performance anxiety, the better the chance that he will have in getting an erection that he is pleased with and keeping that erection.
When anxiety takes hold, the best tactic is to redirect one's thoughts to whatever activity or stimulus is pleasurable and erotic in the moment. Don't worry about what will happen 5 minutes from now since you are only in control of the present. Similarly, don't continue to beat yourself up about past disappointments, because those moments have passed and you have the ability to shape each moment differently. Instead, pick the first thing that is the most erotic for you and let yourself completely focus on this. Sex is much better when it is a "want to" and not a "have to."