I have a couple of clients whose jobs have big cycles. They have periods where everything is relaxed, and other periods where things are very frustrating and difficult. My job in algorithms is a lot like this too, at first you have no idea what it is you are trying to do. Once you figure it out, the implementation is very enjoyable, but the time before that is very frustrating. I used to feel anxiety and unsure of myself at these times, but now I recognize it is all part of a cycle.
It is your choice if you want to say things like "I’m on edge all week because work is frustrating." I contend that this choice does not serve you. Another choice you can make would be to recognize that this is part of a cycle. This choice likely means less anxiety and frustration.
Recognize cycles. They do not have to control how you feel, that is your decision.