In response to:
But I want to use square_pos.m which includes square.m inside. I wanted to change its codes but I was not sure if it affects some other functions which I am using in some other parts of my main optimisation program. Then I thought the best way is to replace square function of MATLAB with square function of cvx.
notice in particular this post by the CVX developer, mcg.
So I think the moral of the story is that is you have the Signal Processing Toolbox installed, don’t use square_pos
on MATLAB double precision variables. But it should still be o.k. to use square_pos
if its argument is a CVX expression or variable.