If no erection can be achieved during sexual activity, special devices can be fixed on the base of the penis at bedtime to monitor whether an erection has happened during sleep. If the test shows that an erection has happened, there is a good chance that the erectile dysfunction could be caused by psychological factors.