1. True or False. (1 points each)
a. All user defined functions must have at least one input and one output variable.
b. All.m files containing functions must begin with a function header.
2. Write a MATLAB function called Trigs that: (9 points)
• Accepts a single angle or vector of angles in radians as an input argument.
• Computes the Sine, Cosine, and Tangent of the input angle(s).
Returns all three values/vectors as separate output variables.
.
3. Write MATLAB code that calls your function with an angle of your choice as input and saves the
result in the variables a (sine), b (cosine), and c (tangent). (4 points)
4. Write MATLAB code that uses the fplot to plot the anonymous function f(x)= x2+5x-3 for an x
range of negative thirty to positive thirty. (5 points)
Extra Credit (5 points):
a) Write a MATLAB function with no inputs or outputs that calculates and displays the average of
the data in a global vector called “nums”. (3 points)
b) Write MATLAB code to define “nums” with any 5 numbers and then calls your function from
part a. (2 points)