MATLAB: Converting these mathematical formulas to a matlab equation.

mathematical formulas

How can i convert these to a proper matlab equation?
v0=25;
theta1= 30;
y0=3.5;
d1=(v0.*cos(theta1).*(v0.*sin(theta1)+ sqrt((v0.*sin(theta1)).^2 + 2.*9.81.*y0)))/9.81
y1=(x1.*tan(theta1))-((1/2).*((9.81.*(x1)^.2)/((v0.*cos(theta1))^.2))) +y0
But
I spend a lot of time to write it but it doesn't work. Thank you.

Best Answer

(x1)^.2
You probably didn't mean to raise a square matrix x1 to the 0.2 power here for two reasons.
By the way, cos isn't quite the correct function to use. It computes the cosine of an angle in radians. But the "See Also" section on its documentation page (doc cos) lists the correct function to use for your problem.
Related Question