Phycological Erectile Dysfunction

I was on a date last night which ended with intimacy at her place afterwards, however I struggled to even get an erection and feel like I’m a disappointment. We discussed about it afterwards and she’s cool about it and we’ve already made plans to meet again, but I don’t want this to be the pattern.

For context I’m M33 and I’ve recently left from a sexless marriage of 11 years, where sex was used more as a weapon to get what she wanted, and whenever I attempted to initiate any form of intimacy with my ex wife, 9.5 times out of 10 I was met with rejection. This has now wired me subconsciously to associate being horney with rejection and as a result I struggle to get and maintain an erection.

Does anyone have any advice besides medication to help counter this? Mentally I am so prepared to have a good time, it just seems that my penis doesn’t want to cooperate.