first, get over it.
second, evaluate. determine what possibilities could have had a direct impact.
i would say a good portion of the time you can attribute the cause to diet, rest, or stress.
the other thing you have to keep in mind is the human body isnt a machine and there are many variables which can affect it. something in your body which you arent conscious of could be taking place. maybe youre fighting something off and now you exerted a lot by doing so so you arent completely prepared to tax the CNS. you could be stressed from work, or school, or lovelife, or anything. you could have to take a shit, it could literally be anything.
just pack it up and go at it another day.learn to communicate with yourself better. your body often tells you things because its imperitive. sleep when youre tired, eat when hungry. your body knows what its doing.