This preview shows page 1. Sign up to view the full content.
Unformatted text preview: b. Write another version of the function that takes in a scalar x input and outputs the corresponding scalar f(x) . The function must be constructed using an explicit if-elseif-else-end construction. Use this function to evaluate and plot f(x) over the same range of x s as in part (a). 4. Consider the relational operation: k = (a < b); where a is a real-valued row vector and b is either a real-valued row vector of the same length as a , or, a scalar. Write a MATLAB function, k = f(a,b); that implements the same relational operation using for-loops and if-statements only. The output k must be of type logical . Test it on the two cases: a = [1 2 0 -3 7]; b = [3 2 4 -1 7]; a = [1 2 0 -3 7]; b = 3; 5. If time permits, do Practice Exercise 9.1 and 9.2 from Ch.9. 1...
View Full Document
- Spring '11