Help with script please!!! pic included!!
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Pam
el 11 de Nov. de 2014
Comentada: Pam
el 12 de Nov. de 2014
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 comentarios
Image Analyst
el 11 de Nov. de 2014
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.
Respuesta aceptada
Image Analyst
el 11 de Nov. de 2014
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Function Creation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!