Where is the error in prompt function in this code?

 Respuesta aceptada

prompt is not a defined variable. Perhaps you should have used
prompt = 'enter an angle in degrees: ';
Note that your prompt talks about degrees, but cos() works in radians. cosd() works in degrees.
Your code would work (not crash) if the user happened to enter a positive integer, but what if the user happened to enter 0 or negative? y(x) when x is 0 would be a problem.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by