MATLAB: Where is the mistake

anonymous functionunbalanced

I'm trying to get this anonymous function to work bur no matter how I do it it keeps telling me that there is something wrong with the parenthesis or brackets. What can I do to fix this?
a=45; g=9.82; v=9.0;
>> throwfun = @(x) x.*tan(a)-((g*x.^2)/(2(v*cos(a))^2));
Error: Unbalanced or unexpected parenthesis or bracket.

Best Answer

You missed the * after 2 in the last terms
use
throwfun = @(x) x.*tan(a)-((g*x.^2)/(2*(v*cos(a))^2));