ED can be occasional and there may be times where you can achieve and maintain an erection. This is particularly common in those who are experiencing psychological ED. The ability to achieve and maintain an erection is dependent on your state of mind.