Dear Hiroyuki,
Manopt is used for minimization problem, so I guess, if you want to minimize the rayleight quotient, the cost function should be :
problem.cost = @(x) trace(x'*(A*x));
With the minus sign, it would solve the maximization problem.
Regarding the gradient, I think the Euclidean gradient should be :
problem.egrad = @(x) 2*A*x;
In case of doubt (in the cost or the gradient), I found this tool (provided in the toolbox) very useful :
Best regards
Florian