I am not exactly sure what the source of the problem is, but I have a few suggestions to help you diagnose the root cause:
First, please change the definition of U0 as follows:
Second, in the next line, when you plot U0, please use the following:
Third, just before computing U2, insert the following intermediate plot:
Fourth, just after computing U2, insert this intermediate plot:
Finally, at the very end, when you plot U3, please use the following:
After reviewing each of these figures, it appears to me that the computation of U1 and U2 seem to be working just fine, but there is something that is not working in the computation of U3. I suspect it may have something to do with how you compute either dx1 and/or x1, but I am not really sure. Maybe the plots will help you figure out what the issue is.