The tangent function is defined as tan(theta) = sin(theta)/cos(theta). This expression can be evaluated to solve for the tangent as long as the magnitude of cos(theta) is no too near to 0. Assume that theta is given in degrees, and write the MATLAB statements to evaluate tan(theta) as long as the magnitude of cos(theta) is greater than or equal to 10e-2. If the magnitude of cos(theta) is less than 10e-2, write out an error message instead.

Respuesta :

Answer:

The code is as attached here.

Explanation:

The code is as given below

theta = input(' Enter the value of theta?');

y = sin(theta*pi()/180);

z = cos(theta*pi()/180);

if z < 0.01

fprintf('The value of theta is very low')

else

t=round(y/z,2);

disp(['The value of tangent theta is ',num2str(t)]);

end

Ver imagen danialamin
Ver imagen danialamin