Write a simple MATLAB function to: 1.Calculate the sin and cos of a value in rad
ID: 646122 • Letter: W
Question
Write a simple MATLAB function to:
1.Calculate the sin and cos of a value in radians (in one function)
2. Calculate the tan and cot of a value in radians (in one function)
For number one I did something like this but I am not sure that its correct. Can someone help me do number 1 and 2? Thank you.
function cos_sin_in_Degrees
% This program displays cos and sin in radians when user enters degrees
%matlab normally displays answers in radians
R=input('enter degrees:');
R*(pi/180);
Sin=sin(R)
Cos=cos(R)
end
__________________________________________
Explanation / Answer
function cos_sin_in_Degrees
prompt = 'Enter degress ';
R = input(prompt)
R*(pi/180);
Sin=sin(R)
Cos=cos(R)
end
function tan_cot_in_Degrees
prompt = 'Enter degress ';
R = input(prompt)
R*(pi/180);
Tan=tan(R)
Cot=cot(R)
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.