3. if-elseif-else-end
a. Write a script file that will accept a numeric input and display whether the value is "positive", "negative", or "zero". Test all possible cases and either use the input function or random generator.
b. Create a script file similar to 3a. with a random value that will display "good" if the input value is between 35 and 50, "terrible" if the between 35 and 15, and "trouble" otherwise. Test each case.
UTRGV
MECE 2350 rev.10/2016
c. Create a function M-file that takes two scalar inputs and one scalar output; the output is the greater of the two inputs. Do not use the built-in functions like min or max for comparison. Test a few cases.
d. Write a function M-file to evaluate the following piecewise function, h(t):
h(t) = 5T when 0 < T < 6
h(t) = 0.5T + 27 when T > 6
h(t) = 0 when T < 0
Test the following three cases: T = 5, T = 9, and T = -2. Plot the function for the range of T from -2 to 10 with solid circle markers at every 0.5 interval.
Using the input function, write a script file that will convert a given value's unit to every prefix from pico to tera.