I have a complex Hermitian matrix, say W, which is obtained by solving a convex optimization problem. In order for this matrix to be the result of my original problem, W must satisfy the following condition rank ( W ) = 1. When I checked this condition, MATLAB gives me an answer 3 for 3x3 W matrix. However, eigenvalues of this matrix are [-2.04e-11,-1.92e-12,2.81]. Now, my question is should I consider W as a rank-1 matrix based on the eigenvalues result or should I consider it as a rank 3 matrix as provided by MATLAB rank condition? (I have learnt that the rank of a symmetric matrix is the number of non-zero eigenvalues. If this is the case, can I also extend this def to Hermitian matrix? and If this def is also true for hermitian matrix, then what should be the rank of W (1 or 3))?
If the matrix has three non-zero eigenvalues, then its rank is $3$. The rank of a $3 \times 3$ matrix is $3$ minus the dimension of the eigenspace corresponding to $0$ (see here for more detail).
However, if you look at the three eigenvalues produced, you'll notice that two of them are very small. I'd wager that they are non-zero because of numerical error; whatever method Matlab has used to arrive at the solution, its approximation is close to, but not, a matrix of rank $1$.
As for how you should proceed, we don't really have the context to answer this. It depends for what purpose you plan to use this matrix.