asin_yourlogin

asin_yourlogin - % ---- INPUTS ----% % ---- CALCULATIONS...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
function [asin_val] = asin_yourlogin(x) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Programmer(s) and Purdue Email Address(es): % 1. ENGR Faculty/Staff % % Section #: ALL % % Assignment #: Homework 4 Problem 3 % % Academic Integrity Statement: % % I/We have not used source code obtained from % any other unauthorized source, either modified % or unmodified. Neither have I/we provided access % to my/our code to another. The project I/we am/are % submitting is my/our own original work. % % asin_yourlogin: checks that the input argument is between -1 and 1 and, % if so, calculates the asin of that value. Otherwise, it returns "value % must be between -1 and 1" % % INPUTS: List them below one line per input argument % x - input value to be calculated (must be between -1 and 1) % OUTPUTS: List them below line per output argument % asin_val - the value of the asin of x % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % ---- INPUTS ----% % ---- CALCULATIONS ----if x>=-1 && x<=1 % Checks if value is between -1 and 1 asin_val = asin(x); % calculates asin for values that are valid else asin_val = 'value must be between -1 and 1'; % assigns error message to output end e % Alternate logic % if x<-1 || x>1 % Checks if value is outside of range % asin_val = 'value must be between -1 and 1'; % assigns error message to output % else % asin_val = asin(x); % calculates asin for values that are valid % end % %---- Test Cases ----% i: x = 0.5 % >> asin_x = asin_yourlogin(0.5) % >> asin_x = 0.5236 % ii: x = -1.9 % >> asin_x = asin_yourlogin(-1.9) % >> asin_x = value must be between -1 and 1 % iii: x = 0 % >> asin_x = asin_yourlogin(0) % >> asin_x = 0 % iv: x = 3 % >> asin_x = asin_yourlogin(3) % >> asin_x = value must be between -1 and 1...
View Full Document

Page1 / 2

asin_yourlogin - % ---- INPUTS ----% % ---- CALCULATIONS...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online