Why will maximizing U with respect to help you find ?
You said you cannot write the code for properly. Do you have a formula for ? Even if you do have the formula for , it will be complicated and nonlinear. When yo set it equal to zero, it will not tell you what is.
If you want a numerical solution for the maximum of U, you don't need to find the point where the derivative equals zero. You can simply use fminsearch() or fminbnd() to minimize . You will need to provide values for the other constants, such as etc.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.