CodeCodeCode

ENGR132: HW04 - asin_name

Mar 30th, 2011
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.54 KB | None | 0 0
  1. function y = asin_name(x)
  2.  
  3. %--------CALCULATIONS---------
  4. % If x is on interval [-1,1]
  5. if x >= -1 && x <= 1
  6.     y = asin(x);
  7. % If x is not on interval [-1,1]
  8. else
  9.     error('Value must be between -1 and 1.');
  10. end
  11.  
  12. %-----------OUTPUT------------
  13. % y = asin_name(0.5)
  14. %
  15. % y =
  16. %
  17. %     0.5236
  18. %
  19. % y = asin_name(-1.9)
  20. % ??? Error using ==> asin_name at 35
  21. % Value must be between -1 and 1.
  22. %  
  23. % y = asin_name(0)
  24. %
  25. % y =
  26. %
  27. %      0
  28. %
  29. % y = asin_name(3)
  30. % ??? Error using ==> asin_name at 35
  31. % Value must be between -1 and 1.
Advertisement
Add Comment
Please, Sign In to add comment