There are a lot of applications for UDF. You can search on any other UDF which is used in same domaine with your work's (in boundary conditions / properties of materials / ...) and change it.
Cherian's submission is spot on. In step wise detail:
1. Understand how your equation interacts with other model variables
2. Develop the execution logic
3. Write it out in C language
4. Enter your C language equation in the UDF tab in Ansys
5. Compile it (still in Ansys)
6. Run your model
You need to pay particular attention to variable names for input and output from your equation. A helpful aid is Ansys documentation for internal names for variables.