Help with script please!!! pic included!!

조회 수: 1 (최근 30일)
Pam
Pam 2014년 11월 11일
댓글: Pam 2014년 11월 12일
I really need help on how to approach the problem. Does anyone know how to go about it or are there any examples like this one? Thank you so much!!!! the picture attached has the problem.
this is what I have this so far:
x= input('Please provide a radian:');
if cos(x)< 10^-20
disp('Invalid value.');
else
cos(x)>=10^-20;
tan(x)=abs(sin(x)/cos(x));
fprint('Tan(x) of the value is %f\n',tan(x));
end
  댓글 수: 4
Pam
Pam 2014년 11월 11일
I did receive an error message. I am stuck in how to get my program to do the conversion of degree and radian and I get an error for the tan equation
Image Analyst
Image Analyst 2014년 11월 11일
You can use the "d" versions so you don't need to convert and you can just enter the values directly in degrees: cosd(), sind(), tand(), atan2d(), etc.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2014년 11월 11일
Try this:
x= input('Please provide a radian: ');
if cos(x)< 10^-20
disp('Invalid value.');
else
tanx = abs(sin(x)/cos(x));
fprintf('Tan(x) of the value %f is %f\n', x, tanx);
end
  댓글 수: 6
Image Analyst
Image Analyst 2014년 11월 12일
I don't know. I have not seen "the question".
Pam
Pam 2014년 11월 12일
oh i added it ti this question it is attatched

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by