I need to solve the following problem: For a given p=(x0,y0,z0,w0) and arbitrary T. For example , let p=(0.8,0.1,0.06,0.04) and T=-1.2. I need to find a vector q=(x,y,z,w) with the minimum distance from p, under the given constraints. I need a numerical solution, I tried using MATLAB but I had a lot of problems with that. I will be glad for some help / ideas. Thanks! 
minimize function with convex constraints
convex optimization